标签:最大 int prim div 图片 mamicode printf alt image
#include <stdio.h> #include <stdlib.h> int main() { int number, max, min, n; n=1; printf("输入第%d个数: ", n); scanf("%d", &number); max = number; min = number; while(n>=1&&n<=4) { n++; printf("输入第%d个数: ", n); scanf("%d", &number); if(number>max) max = number; else if(number<min) min = number; } printf("最大数为: %d\n", max); printf("最小数为: %d\n", min); system("pause"); return 0; }
#include<stdio.h> #include<math.h> int isprime(int n); int main() { int i; int s; s=0; for(i=101;i<=200;i++) { if(isprime(i)) { s++; printf("%5d",i); } } printf("\n") ; printf("101~200之间共有%d个素数",s); return 0; } int isprime(int n) { int k; for(k=2;k<=sqrt(n);k++) if(n%k==0) return 0; return 1; }
#include<stdio.h> int main(){ long int s,a=1,b=0; printf("请输入一个数字:\n"); scanf("%ld",&s); while(s) { if((s%10)%2==1) { b=b+(s%10)*a; a=a*10; } s=s/10; } printf("新数字是:%ld\n",b); return 0; }
#include<stdio.h> int main(){ int n,a,i; double s,m; m=0;s=0;i=1; printf("请输入n和a:"); scanf("%d%d",&n,&a); while(i<=n) { m=m*10+a; s=s+i/m; i++; } printf("s=%lf",s); return 0; }
标签:最大 int prim div 图片 mamicode printf alt image
原文地址:https://www.cnblogs.com/Simply777/p/11876977.html