23 lines
497 B
C
23 lines
497 B
C
/*-------------------------------------------------------
|
|
功能:从键盘输入2个整数相加,再输入答案,如果正确,显示"right",否则显示"error"。
|
|
--------------------------------------------------------*/
|
|
#include "stdio.h"
|
|
main( )
|
|
{
|
|
int a,b,c;
|
|
printf("please input a and b:\n");
|
|
scanf("%d,%d",&a , &b);
|
|
printf("please input the answer:\n");
|
|
scanf("%d",&c);
|
|
/**********Program**********/
|
|
if(a+b==c)
|
|
|
|
|
|
|
|
|
|
/********** End **********/
|
|
printf("right\n");
|
|
else
|
|
printf("error\n");
|
|
}
|