标签:src ret 之间 个数 include mat long std sys
#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<5) { 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 prime(unsigned int); int main() {unsigned int m,n; n=101;m=0; do{ if(prime(n)!=0) { printf("%u\n",n); m++;} n+=1; } while(n<=200); printf("101~200之间共有%u\n个素数",m); return 0; } int prime(unsigned int x) {int i,k; k=sqrt(x); for(i=2;i<=k;i++) {if(x%i==0) return 0; else if(i>k) return 1; } }
#include<stdio.h> int main() {long int x; int a,b,c; b=0; c=1; printf("Enter a number:"); scanf("%d",&x); while(x=x/10) {a=x%10; if(a%2!=0) b=b+a*c; c=c*10; } printf("new number is:%d",b); return 0; }
#include<stdio.h> int main() {int n,a,i,b; float m=0,s=0; b=1; printf("Enter a and n:"); scanf("%d%d",&a,&n); for(i=1;i<=n;i++) {m=m+a*b; s=s+(float)i/m; b=b*10; } printf("s=%f",s); return 0; }
标签:src ret 之间 个数 include mat long std sys
原文地址:https://www.cnblogs.com/1234cwy/p/11883300.html