0
How output is 35
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) } }
2 odpowiedzi
+ 3
The value of a becomes 7 as
a+=f+1 i.e. a = a + f + 1 = 1 + 5 + 1 = 7
But the value of f doesn't change because loop doesn't execute as the condition becomes false in for loop.
So, the product f*a gets printed i.e. 35.
0
thanks #amit