+ 1
Anyone to help me understand this c code.
I don't know where the 6 value goes .the int main block is so confusing. /*need for explanation*/ #include <stdio.h> int fact(int p);//function declaration int main(){//main function block int n=6,m; m=fact(n); printf("This the result:%d",m); return 0; } int fact(int p){ int s=1,g; for(g=p;g>=5;g--); s=s*g; return s;
2 Respuestas
+ 2
We can call the function fact(6)
So fact function will receive p=6.
See this function return int number. This int assigns a value to m.
m = fact(6) ;
+ 1
The code is not right and doesn't find the factorial of a number so I made some corrections to make it work right.
Also I have given a little description of each line for you to understand.
https://code.sololearn.com/c1nj1wrEX3R2/?ref=app