- #include<stdlib.h>
- #include<stdio.h>
- main()
- {
- int a,b,c,x=0;
- while(x<5)
- {a=rand()%100;
- b=rand()%100;
- if(a+b>100)
- continue;
- printf("\\n%d+%d=? ",a,b);
- scanf("%d",&c);
- if(c==a+b)
- {printf("the answer is right");
- x++;
- }
- else
- {printf("The answer is wrong");x=0;
- }
- }printf("\\n program is over");
- }
转载于:https://blog.51cto.com/3595505/760953