Okai here is the Code so far, It's not bad But the teacher told me to add a Main function that calls my sum function. WTF? wouldn't the compiler go crazy if I change the 'main' function because its the MAIN! function. And what does he mine by a function that calls the other. Here is the program it works, but I need someone to just organize it with a function that calls this sum function. So this is simple basic C-free program so no complex things please
Code:
#include <stdio.h>
int sum(int x, int y);
int
main(void)
{
int x,y;
x=7;y=2;
printf(" x y result\n\n");
printf("%4d%4d%4d\n",x,y,sum(x,y));
printf("%4d%4d%4d\n",x,y,sum(y,x));
printf("%4d%4d%4d\n",sum(sum(y,x),y),y,sum(x,y));
printf("%4d%4d%4d\n",(sum(sum(y,x),sum(y,x))),y,sum(x,y));
printf("%4d%4d%4d\n",(sum(sum(y,x),sum(y,x))),sum(y,y),sum(x,y));
return(0);
}
int sum(int x,int y)
{
int result;
result=x+y;
return(result);
}