标签:clu use img class 最大 sharp lib sqrt max
#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<=4) { n++; printf("输入第%d个数: ", n); scanf("%d", &number); if(number>n) max = number; else if(number<n) 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,n; n=0; for(i=101;i<=200;i++) { if(isprime(i)) { printf("%4d",i); n++; if(n%5==0) printf("\n"); } } 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> #include<math.h> int main() { long int number; int i,n,s; s=0,n=0; printf("Enter a number :
"); scanf("%ld",&number); for(;number!=0;) { i=number%10; number=number/10; if (i%2!=0) { n++; s+=pow(10,n)*i; } } printf("new number is : %ld",s/10); return 0; }
对循环语句运用不熟练,仍要多加练习,算法要想半天
标签:clu use img class 最大 sharp lib sqrt max
原文地址:https://www.cnblogs.com/zfdo/p/11871282.html