#include<stdio.h>
main(){ int x,y,sum; printf ("input x y:"); scanf("%d%d",&x,&y); sum=add(x,y); printf("sum=%d\n",sum);}add(a,b)int a,b;{ return (a+b);}
int add(a,b){ return (a+b);}main(){ int x,y,sum; printf ("input x y:"); scanf("%d%d",&x,&y); sum=add(x,y); printf("sum=%d\n",sum);}
你最好将scanf("%d%d",&x,&y);也改一下,在两个%d之间加一个空格:scanf("%d %d",&x,&y);输入的时候两个数也用空格隔开.
同意楼上说的 标准一点的是:#include<stdio.h>
int add(int a,int b){ return (a+b);}int main(void){ int x,y,sum; printf ("input x y:"); scanf("%d %d",&x,&y); /*此处写成 scanf("%d,%d",&x,&y);也很好 */ sum=add(x,y); printf("sum=%d\n",sum); return 0;}
楼上是什么意思? 哪里return 0?