直接求两数之和include<stdio.h>int main (){int a,b,sum; //申明a,b,sum为整型
a=1;b=1; //给a,b赋值,这里a,b自己定
sum=a+b; //求和
printf{"the sum is %d",sum}; //输出sum的值
return (0);}
求输入的两数之和#include<stdio.h>int main (){int a,b,sum;
printf{"Please enter x,y:"}; //提示输入x,y
scanf{"%d,%d",&a,&b}; //将输入的值赋给a,b
sum=a+b; //求和
printf{"the sum is %d",sum}; //输出sum的值
return (0);
}