C语言上机150道题

26

#include #include main() {

int i,s; s=0;

for(i=2;i<=100;i=i+2) s=s+i;

printf(\到100的偶数和是:\ printf(\ getch(); } 27

#include #include #include int isprime(int m)

{ int i; for(i=2;i<=sqrt(m);i++) if(m%i==0)

{return 0;break;} if(i>=(int)sqrt(m)+1) return 1; } main() { int n,flag;

for(n=1;n<=200;n++) {

flag=isprime(n); if(flag)

printf(\ } getch(); } 28

#include #include main() { float a,t;

printf(\scanf(\if(a<0)

t=-a; else t=a;

printf(\getch(); } 29

#include #include main() {

char ch; ch=getchar(); if(ch=='+') printf(\ else if(ch=='-') printf(\ else if(ch=='*') printf(\ else if(ch=='/') printf(\ else

printf(\

system(\} 30

#include #include main() {

char n1='a',n2='r',n3='f',n4; char m1='A',m2='R',m3='F'; printf(\请输入一个字符:\ scanf(\ if(n4==n1||n4==m1) { printf(\ printf(\ }

else if(n4==n2||n4==m2) { printf(\ printf(\ }

else if(n4==n3||n4==m3)

联系客服:779662525#qq.com(#替换为@)