haha1235 |
|
||
2013年10月5日
摘要:
#include int 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'); } } 阅读全文
摘要:
#include int main(void){ int i,j; int a[3][2]; for(i=0;i<3;i++) for(j=0;j<2;j++) a[i][j]=i+j; for(i=0;i<3;i++){ for(j=0;j<2;j++) printf("%4d",a[i][j]); printf("\n"); } return 0;} 阅读全文
摘要:
#include int main(void){ int i; int fib[10]={1,1}; for(i=2;i<10;i++) fib[i]=fib[i-1]+fib[i-2]; for(i=0;i<10;i++){ printf("%6d",fib[i]); if((i+1)%5==0) printf("\n"); } return 0;} 阅读全文
摘要:
#include int main(void){ char ch='w'; int a=2,b=0, c=0; float x=3.0; printf("%d",a&&b); printf("%d",a||b&&c); printf("%d",!a&&b); printf("%d",a||3+10&&2); printf("%d",!(x==2)); printf("%d",!x==2); pri 阅读全文
摘要:
#include int main(void){ char ch='w'; int a=2,b=3, c=1,d,x=10; printf("%d",a>b==c); printf("%d",d=a>b); printf("%d",ch>'a'+1); printf("%d",d=a+b>c); printf("%d",b-1==a!=c); printf("%d\n",3<=x<=5); return 0; 阅读全文
摘要:
#include int 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;} 阅读全文
摘要:
#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;} 阅读全文
摘要:
#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;} 阅读全文
摘要:
#include int 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;} 阅读全文
摘要:
#include double 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;n; for(i=1;i<=n;i++) result= result*i; return result;} 阅读全文
|
Copyright © 2024 haha1235
Powered by .NET 9.0 on Kubernetes |