java - For Loop, Int Max -


i beginner in java, can please explain me code means , how comes answer of 15. understand loop not doing int max.

int count; int max = 3; (count = 1; count < 7; count++) {     max = max + 2; } system.out.println(max); 

so loops counting loops. can number of times. in case count starts @ 1 , goes until 6 because last run count less 7. in effect amount of max starts @ 3 , has 2 added 6 times, number of times loop runs. hope helps! finished first year of cs, im glad had chance help.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -