0

What happend with my code I don't know

// Without arguments and with return value : int Sum(); /* Declaration of Function */ /*Other Code*/ int Sum() { int x,y,z; printf("Enter no. 1 : \t"); scanf("%d",&x); printf("\nEnter no. 2 : \t"); scanf("%d",&y ); z=x+y; return z; }

25th Dec 2021, 2:23 PM
Bong Rush Gaming YT
1 RĂ©ponse
0
Your code hasn't problems, apart that in C, there is always a main() function that returns an int, this functions is executed when the programs start so your code must be : // Without arguments and with return value : int Sum(); /* Declaration of Function */ int main() { printf("\nThe result is : %d", Sum()); return 0; } /*Other Code*/ int Sum() { int x,y,z; printf("Enter no. 1 : \t"); scanf("%d",&x); printf("\nEnter no. 2 : \t"); scanf("%d",&y ); z=x+y; return z; }
25th Dec 2021, 3:36 PM
VCoder
VCoder - avatar