码迷,mamicode.com
首页 > 其他好文 > 详细

生成30道四则运算

时间:2018-09-29 21:38:06      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:源程序   com   size   str   运行   生成   ima   stdio.h   bsp   

源程序代码:

#include<stdio.h>
int main()
{
int i,a,b,m;
for(i=0;i<30;i++)
{
a=rand()%(99-10+1)+10;
b=rand()%(99-10+1)+10;
m=rand()%(4-1+1)+1;
{
if(m==1)
printf("%d+%d=\n",a,b);
else if(m==2)
printf("%d-%d=\n",a,b);
else if(m==3)
printf("%d*%d=\n",a,b);
else if(m==4)
printf("%d/%d=\n",a,b);
}
}
}

运行结果截图:

技术分享图片

 

生成30道四则运算

标签:源程序   com   size   str   运行   生成   ima   stdio.h   bsp   

原文地址:https://www.cnblogs.com/zoulan/p/9726476.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!