Can anyone explain step by step why the result is 32? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone explain step by step why the result is 32?

static int Func(int a =3,int b=7,int c = 6) { return a + b * c; } static void Main(string[] args) { int a = 4; int b = 5; int c = 2; Console.WriteLine(Func(c,b)); }

8th Jan 2020, 6:00 PM
Giura Emanuel
Giura Emanuel - avatar
1 Answer
+ 5
You used c and b for function then inside function a is 2 and b is 5, when you called function you haven't passed c and the c is coming from the default value 6 Then a+b*c(2+5*6) = 32
8th Jan 2020, 6:06 PM
Abdol Hashimi
Abdol Hashimi - avatar