java - Loops, trouble understanding loops please help a beginner -



java - Loops, trouble understanding loops please help a beginner -

int a= io.readint(); int b = io.readint(); int z = 0; int i; for(i =0; z<=b; i++) { z=z+a; } system.out.println(i);

a.) actual output of code, given next input? input: reads in 20, b reads in 75.

b). mathematical operation code resemble.

c. implemented code correctly accomplish operation identified in (b)? if provide test cases show this. if not, prepare bug in code. ``

ok professor went on answers , want know if of guys can explain happening in code. got a.) 4 don't understand how 4. , mathematical operation code resemble got += add-on , no close answer. need improve understanding on loops, help much appreciated.

the output how many times loop continued until z > b. simple add-on z + each time through , should understand how it's executed

java

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -