0

How can l slove this output? Plz explain ? Why it's out put to show 1

Int x= 10; for(i= 1; i <=5; i +=2){ x=x-i; } Cout<<x;

20th Aug 2020, 9:24 PM
Suparna Podder
Suparna Podder - avatar
1 Resposta
+ 5
it will show you one because when the loop runs first so i=1 now so its 10-1= 9 when loop run on second time so i +2 = 3 so its 9-3=6 when loop run third time so now i which was before 3 now added 2 more so 3 +2 = 5 now i value is 5 so its 6-5=1 Thats why its showing you 1 in the output
20th Aug 2020, 9:38 PM
Abdul Azeez
Abdul Azeez - avatar