+ 2

how this code i want explanation

static int Pow(int x, int y=2) { int result = 1; for (int i = 0; i < y; i++) { result *= x; } return result; }

17th Jul 2017, 11:05 AM
Malak Naim
Malak Naim - avatar
2 Respostas
+ 21
It is a code for power number: if you input only 2 (y is default) it will power 2 meaning is 2*2=4 if you talk on looping: loop 1 i=0 x=2 result=2 loop 2 i=1 x=2 result=4 and it output 4
17th Jul 2017, 11:09 AM
Nithiwat
Nithiwat - avatar
+ 2
No the Output is 36
27th Jul 2017, 6:23 PM
niccoob _
niccoob _ - avatar