c编程问题,菜鸟级

来源:百度知道 编辑:UC知道 时间:2024/06/29 00:48:38
就要求写一数学加减题,但要求是随机的.答案0-100之间
比如'
4+5: 9
YES(要写出YES来哦)

二楼的不错,不过楼主要求答案在0-100之内,所以我把你的程序修改一下
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int a,b,c;
srand(time(0));
loop:
a=rand()%101;
b=rand()%101;
if ( a + b > 100 )
goto loop;
printf("%d+%d:",a,b);
scanf("%d",&c);
if(a+b==c)
printf("Yes\n");
else
printf("No\n");
return 0;
}

这还菜...

是很菜,不知道你用什么程序
dim a as integer
dim b as integer
dim c as integer
if a + b = c then print "yes"
else print "no"
end if

我的编程是这样的.不知道你的和我的有没有一样

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int a,b,c;
srand(time(0));
a=rand()%101;
b=rand()%101;
printf("%d+%d:",a,b);
scanf("%d",&c);