2013年10月8日
摘要: #includeint main(void){ int i,index,k,n,temp; int a[10]; printf("Enter n:"); scanf("%d",&n); printf("Enter %d integers:",n); for(i=0;i<n;i++) scanf("%d",&a[i]); for(k=0;k<n-1;k++){ index=k; for(i=k+1;i<n;i++) if(a[i]<a[index]) index=i; temp 阅读全文
posted @ 2013-10-08 06:41 yy99 阅读(107) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ char ch; printf("input characters:"); ch=getchar(); while(ch!='\n'){ if(ch>='A'&&ch='a'&&ch<='z') ch=ch-'a'+'A'; putchar(ch); ch=getchar(); } return 0;} 阅读全文
posted @ 2013-10-08 06:39 yy99 阅读(111) 评论(0) 推荐(0) 编辑
摘要: #includefloat result_real,result_imag;int main(void){ float imag1,imag2,real1,real2; void complex_prod(float real1,float image2,float real2,float imag2); void complex_add(float real1,float image2,float real2,float imag2); printf("Enter 1st complex number number(real and imaginary):"); ... 阅读全文
posted @ 2013-10-08 06:33 yy99 阅读(156) 评论(0) 推荐(0) 编辑
摘要: #include#includeint main(void){ double e,pi; double funpi(double e); printf("Enter e:"); scanf("%lf",&e); pi=funpi(e); printf("pi=%f\n",pi); return 0;}double funpi(double e){ int denominator,flag; double item,sum; flag=1; denominator=1; item=1.0; sum=0; whil... 阅读全文
posted @ 2013-10-08 06:33 yy99 阅读(122) 评论(0) 推荐(0) 编辑
摘要: #include#includeint main(void){ int count,m; int prime(int m); count=0; for(m=2;m<=100;m++){ if(prime(m)!=0){ printf("%6d",m); count++; if(count%10==0) printf("\n"); } } printf("\n");}int prime(int m){ int i,n; if(m==1)return 0;... 阅读全文
posted @ 2013-10-08 06:32 yy99 阅读(142) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ void pyramid(int n); pyramid(5); return 0;}void pyramid(int n){ int i,j; for(i=1;i<=n;i++){ for(j=1;j<=n-i;j++) printf(" "); for(j=1;j<=i;j++) printf(" %d",i); putchar('\n'); }} 阅读全文
posted @ 2013-10-08 06:32 yy99 阅读(117) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ double height,radius,volume; double cylinder(double r,double h); printf("Enter radius and height:"); scanf("%lf%lf",&radius,&height); volume=cylinder(radius,height); printf("Volume=%.3f\n",volume); return 0;}double cylinder(double r,doubl 阅读全文
posted @ 2013-10-08 06:30 yy99 阅读(110) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int child,men,women; for(men=0;men<=45;men++) for(women=0;women<=45;women++) for(child=0;child<=45;child++) if(men+women+child==45&&men*3+women*2+child*0.5==45) printf("men=%d,women=%d,child=%d\n",men,women,child); ... 阅读全文
posted @ 2013-10-08 06:30 yy99 阅读(265) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int child,men,women; for(men=0;men<=15;men++) for(women=0;women<=22;women++){ child=45-women-men; if(men*3+women*2+child*0.5==45) printf("men=%d,women=%d,child=%d\n",men,women,child); } return 0;} 阅读全文
posted @ 2013-10-08 06:29 yy99 阅读(102) 评论(0) 推荐(0) 编辑
摘要: #include#includeint main(void){ int count,i,m,n; count=0; for(m=2;mn){ printf("%6d",m); count++; if(count%10==0) printf("\n"); } } printf("\n"); return 0;} 阅读全文
posted @ 2013-10-08 06:20 yy99 阅读(90) 评论(0) 推荐(0) 编辑