+ 1

a question from c# challenge

What is the output of this code. int prd=1 for (int x= 5; x< 10; x += 3){ prd *= x; } Console.Write(prd) ; *Please explain this*

31st Mar 2018, 5:56 AM
Ravneet Singh
Ravneet Singh - avatar
3 Answers
+ 1
is it 40
31st Mar 2018, 5:58 AM
G.S.N.V. Suraj
G.S.N.V. Suraj - avatar
+ 1
40 is correct. I placed some extra lines in the code, to show how it works. note that x *= prd is equal to x = x * prd https://code.sololearn.com/cR3wOZ4PG1lv/?ref=app
31st Mar 2018, 6:35 AM
sneeze
sneeze - avatar
0
thnx
31st Mar 2018, 6:48 AM
Ravneet Singh
Ravneet Singh - avatar