2013年10月6日
摘要:
#includedouble fact_s(int n);int main(void){int i,n;printf("Input n:");scanf("%d",&n);for(i=1;i<=n;i++)printf("%3d!=%.0f\n",i,fact_s(i));return 0;}double fact_s(int n){static double f=1;f=f*n;return(f);} 阅读全文
posted @ 2013-10-06 22:57
1850年老街
阅读(85)
推荐(0)
编辑
摘要:
#includefloat cash;int main(void){int choice;float value;void income(float number),expend(float number);cash=0;printf("Enter operate choice(0--end,1--income,2--expend):");scanf("%d",&choice);while(choice!=0){if(choice==1||choice==2){printf("Enter cash value:");scanf 阅读全文
posted @ 2013-10-06 22:53
1850年老街
阅读(76)
推荐(0)
编辑
摘要:
#includeint x;int f( );int main(void){int a=1;x=a;a=f( );{int b=2;b=a+b;x=x+b;}printf("%d%d",a,x);return 0;}int f( ){int x=4;return x;} 阅读全文
posted @ 2013-10-06 22:39
1850年老街
阅读(78)
推荐(0)
编辑
摘要:
#includefloat result_real,result_imag;int main(void){float imag1,imag2,real1,real2;void complex_prod(float real1,float imag1,float real2,float imag2);void complex_add(float real1,float imag1,float real2,float imag2);printf("Enter 1st complex number(real and imaginary):");scanf("%f%f&q 阅读全文
posted @ 2013-10-06 17:20
1850年老街
阅读(99)
推荐(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-06 16:05
1850年老街
阅读(97)
推荐(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; n=sqrt(m); for(i = 2;i<=n;i++ 阅读全文
posted @ 2013-10-06 15:29
1850年老街
阅读(95)
推荐(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;while(fabs(item)>=e){it 阅读全文
posted @ 2013-10-06 14:08
1850年老街
阅读(74)
推荐(0)
编辑
摘要:
#includeintmain(void){doubleheight,radius,volume;doublecylinder(doubler,doubleh);printf("Enterradiusandheight:");scanf("%lf%lf",&radius,&height);volume=cylinder(radius,height);printf("Volume=%.3f\n",volume);return0;}doublecylinder(doubler,doubleh){doubleresult;r 阅读全文
posted @ 2013-10-06 13:55
1850年老街
阅读(78)
推荐(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-06 13:44
1850年老街
阅读(78)
推荐(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);return 0;} 阅读全文
posted @ 2013-10-06 13:43
1850年老街
阅读(93)
推荐(0)
编辑
摘要:
#includeint main(void){int i,x1,x2,x;x1=1;x2=1;printf("%6d%6d",x1,x2);for(i=1;i<=8;i++){x=x1+x2;printf("%6d",x);x1=x2;x2=x;}printf("\n");return 0;} 阅读全文
posted @ 2013-10-06 13:36
1850年老街
阅读(90)
推荐(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-06 13:32
1850年老街
阅读(88)
推荐(0)
编辑
摘要:
#includeint main(void){int x;printf("Enter x:");scanf("%d",&x);while(x!=0){printf("%d",x%10);x=x/10;}return 0;} 阅读全文
posted @ 2013-10-06 13:24
1850年老街
阅读(100)
推荐(0)
编辑
摘要:
#includeint main(void){int mark,max;printf("Enter marks:");scanf("%d",&mark);max=mark;while(mark>=0){if(max<mark)max=mark;scanf("%d",&mark);}printf("Max=%d\n",max);return 0;} 阅读全文
posted @ 2013-10-06 13:20
1850年老街
阅读(67)
推荐(0)
编辑
摘要:
#includeint main(void){int i,mark,max,n;printf("Enter n:");scanf("%d",&n);printf("Enter%dmarks:",n);scanf("%d",&mark);max=mark;for(i=1;i<n;i++){scanf("%d",&mark);if(max<mark)max=mark;}printf("Max=%d\n",max);return 0;} 阅读全文
posted @ 2013-10-06 13:15
1850年老街
阅读(85)
推荐(0)
编辑
摘要:
#includeint main(void){int i,j;double item,sum;sum=0;for(i=1;i<=100;i++){item=1;for(j=1;j<=i;j++)item=item*j;sum=sum+item;}printf("1!+2!+...+100!=%e\n",sum);return 0;} 阅读全文
posted @ 2013-10-06 13:10
1850年老街
阅读(98)
推荐(0)
编辑
摘要:
#includedouble fact(int n);int main(void){int i;double sum;sum=0;for(i=1;i<=100;i++)sum=sum+fact(i);printf("1!+2!+...+100!=%e\n",sum);return 0;}double fact(int n){int i;double result;result=1;for(i=1;i<=n;i++)result=result*i;return result;} 阅读全文
posted @ 2013-10-06 12:59
1850年老街
阅读(95)
推荐(0)
编辑
摘要:
#include#includeint main(void){int mynumber=38;int count=0,yournumber;for(count=1;countmynumber)printf("Sorry!your number is bigger than my number!\n");elseprintf("Sorry!your number is smaller than my number!\n");}printf("Game is over!\n");return 0;} 阅读全文
posted @ 2013-10-06 12:54
1850年老街
阅读(72)
推荐(0)
编辑
摘要:
#include#includeint main(void){int i,m;printf("Enter a number:");scanf("%d",&m);for(i=2;im/2&&m!=1)printf("%d is a prime number!\n",m);elseprintf("NO!\n");return 0;} 阅读全文
posted @ 2013-10-06 12:45
1850年老街
阅读(83)
推荐(0)
编辑
摘要:
#include#includeint main(void){int count,number;count=0;printf("Enter a number:");scanf("%d",&number);if(number<0)number=-number;do{number=number/10;count++;}while(number!=0);printf("It contains %d digits.\n",count);return 0;} 阅读全文
posted @ 2013-10-06 12:38
1850年老街
阅读(87)
推荐(0)
编辑
|