四则运算的问题

任务,出30道100以内的四则运算,不能有重复
代码
#include <stdlib.h> #include <stdio.h> #include <time.h> main( ) { int a=0; int b=0; int i,c; srand((unsigned)time(NULL)); for (i=0;i<30;i++) { a=rand()%100; b=rand()%100; c=rand()%4; printf("%d",a); switch(c) { case 0: printf("+%d=\n",b); break; case 1: printf("-%d=\n",b); break; case 2: printf("*%d=\n",b); break; case 3: printf("/%d=\n",b); break; default: printf("错误\n"); break; } } return 0;
}
运行结果

猜你喜欢

转载自www.cnblogs.com/hyjht/p/9752232.html