实际上,我正在学习C语言,并且编写了一个程序
输入2个数字的值,如下所示。
#include<stdio.h>
int main()
{
int a, b, c;
printf("Enter two numbers to add\n");
scanf("%d%d", &a, &b);
printf("Sum of the numbers = %d\n", c);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我输入一个字母,我会得到一些1522222数字。取而代之的是,如果我输入字母(即a,b,c),它会抛出错误作为无效输入。
我该怎么办?