+ 1
Can any one explain this?
Its a challenge in java i really cant understand! public class Program { public static void main(String[] args) { int a=1;int f=5; for (; (a+=f+1)<7;) { f=a% (f+1); } System.out.print (f*a); } } output: 35 but but.. how??
2 Answers
0
there is no initialization & there is no something todo after finishing loop. there is only condition
so FOR was written like that
for(; condition. ;)
condition: a=a+f+1=1+5+1=7
so a<7 is false.. so skip for loop, it won't be executed
finally print f*a=5*7=35
+ 1
Thank you! ;) @Dina