Part1:
Part2:
#include <stdio.h> #include <stdlib.h> int main () { int Number, max, min, n-; n-=. 1; the printf ( "Enter the number of D%:", n-); Scanf ( " % D ", & number); max = number; min = number; the while (n-<. 5) { n-++; the printf (" enter number of% D: ", n-); Scanf ("% D ", & number); IF (max <= number) max = number; the else IF (min> = number) min = number; } the printf ( "maximum number:% d \ n", max); the printf ( "minimum number:% d \ n ", min); System (" PAUSE "); return 0; }
part3
#include <stdio.h> int main(){ int n=0; int x=101; int a=2; for(;x<=200;a=2){ while(x%a) { if(a<x) {a++;} } if(a==x) { n++; if(n%5!=0) {printf("%6d",x);} else {printf("%6d\n",x);} } x++; } printf("\n"); printf("101~200之间共有%d个素数。",n); return 0; }
#include <stdio.h> #include <math.h> int main(){ int number; int n=0; int a,b; int result=0; printf("Enter a number:"); scanf("%d",&number); while(number){ a=number%10; number=number/10; if(a%2){ n++; result=result+a*pow(10,n-1); } } printf("new number is:%d",result); return 0; }
#include<stdio.h> int main() { double n,a,j; double s=0,m=1; printf("Enter n and a:"); scanf("%lf%lf",&n,&a); for(j=1.0000;j<=n;j++) { s=(j/m)+s; m=m*10+1; } printf("s=%.6lf",s/a); return 0; }