方法一 (有scanf_s)
#include<stdio.h>
int main()
{
int a = 0;
int b = 0;
printf("请输入两个整数:");
scanf_s("%d %d", &a, &b);
int sum = a + b;
printf("sum=%d\n", sum);
return 0;
}
方法二(无scanf_s)
#include<stdio.h>
int main()
{
int a = 0;
int b = 0;
printf("请输入两个整数:");
scanf_s("%d %d", &a, &b);
printf("%d+%d=%d", a, b, a + b);
return 0;
}