- 博客(4)
- 收藏
- 关注
原创 判断素数
判断素数 代码如下: #include <stdio.h> #include <stdlib.h> int main() { int x; int count=0; int i; scanf("%d",&x); for(i=2;i<x;i++) { if(x%i0) count++; } if(count0) printf(“This is a prime.”); else printf(“This is not a prime.”); return 0; } 运行结果
2021-01-26 10:22:56
120
原创 求两个整数之和
求两个整数之和 代码: #include <stdio.h> #include <stdlib.h> int main() { int a,b; int he; scanf("%d %d",&a,&b); he=a+b; printf("%d",he); return 0; } 运行结果:
2021-01-23 15:27:33
158
原创 求三个整数中的最大值
输入三个数,输出最大值 #include <stdio.h> #include <stdlib.h> int main() { int a,b,c; int max; scanf("%d %d %d",&a,&b,&c); if(a>b&&a>c) max=a; else if(b>a&&b>c) max=b; else max=c; printf("%d",max); return 0; } 运行结果
2021-01-21 19:32:10
1629
原创 摄氏温度转化为华氏温度
输入摄氏温度(c),转化为华氏温度(f)并输出 #include <stdio.h> #include <stdlib.h> int main() { float c; float f; scanf("%f",&c); f=c9/37; //华氏=摄氏9/37 printf(“f=%.2f”,f); return 0; }
2021-01-17 17:35:57
574
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅