黄义方 作业4
#include<stdio.h> int main() { int i,sum=0; for(i=1;i<=100;i++) sum+=i; printf("sum=%d\n",sum); return; }
#include<stdio.h> int main(){ char c; int zm=0,sz=0,kg=0,qt=0; while((c=getchar())!='\n'){ if(c>='a'&&c<='z'||c>'A'&&c<='Z') zm++; else if(c==' ') kg++; else if(c>='0'&&c<='100') sz++; else qt++; } printf("字母个数:%d\n",zm); printf("空格个数:%d\n",kg); printf("数字个数:%d\n",sz); printf("其他个数:%d\n",qt); return 0;
#include<stdio.h> int main(){ i=n; jiec = 1; while(i<=n){ jiec = jiec * i; i++; } printf("%d!=%d\n",n,jiec); return 0; }
#include<stdio.h> int main(){ int m,n,t,i; printf("ÇëÊäÈëÁ½¸öÕûÊý:"); scanf("%d%d",&m,&n); if(n>m){ t=m; m=n; n=t; } for(i=n;i>=1;i--) if(m%i==0&&n%i==0) break; printf("m=%d,n=%d",m,n); if(i!=0) printf(",×î´ó¹«Ô¼ÊýΪ:%d",i); return 0; }
#include<stdio.h> int main(){ int n,k1,k2,k3; for(k1=0;k2<=9;k1++) for(k2=0;k2<=9;k2++) for(k3=1;k3<=9;k3++){ if(k3*100+k2*10+k1==k1*k1*k1+k2*k2*k2+k3*k3*k3) printf("%d\n",k3*100+k2*10+k1); } return 0; }
posted on 2016-10-13 11:42 huangyifang 阅读(99) 评论(1) 编辑 收藏 举报