haha1235 |
|
||
2013年10月7日
摘要:
#includeint main(void){ int i,n; double product; printf("Enter n:"); scanf("%d",&n); product=1; for(i=1;i<=n;i++){ product=product*i; } printf("product=%.0f\n",product); return 0;} 阅读全文
摘要:
#includeint main(void){ int i,n,sum; printf("Enter n:"); scanf("%d",&n); sum=0; for(i=1;i<=n;i++){ sum=sum+i; } printf("Sum of numbers from 1 to %d is %d\n",n,sum); return 0;} 阅读全文
摘要:
#includeint main(void){ int fahr,lower,upper; double celsius; printf("Enter lower:"); scanf("%d",&lower); printf("Enter upper:"); scanf("%d",&upper); printf("fahr celsius\n"); for(fahr=lower;fahr<=upper;fahr++){ celsius=(5.0/9.0)*(fahr-32) 阅读全文
摘要:
#include#includeint main(void){ int money,year; double rate,sum; printf("Enter money:"); scanf("%d",&money); printf("Enter year:"); scanf("%d",&year); printf("Enter rate:"); scanf("%If",&rate); sum=money*pow(1+rate,year); print( 阅读全文
摘要:
#includeint main(void){ double x,y; printf("Enter x(x>=0):\n"); scanf("%lf",&x); if(x<=15){ y=4*x/3; } else{ y=2.5*x-10.5; } printf("y=f(%f)=%.2f\n",x,y); return 0;} 阅读全文
摘要:
#includeint main(void){ int celsius,fahr; fahr=100; celsius=5*(fahr-32)/9; printf("fahr=%d,celsius=%d\n",fahr,celsius); return 0;} 阅读全文
摘要:
#includeint main(void){ printf("Hello World!\n"); return 0;} 阅读全文
摘要:
#includeint main(void){ printf("Programming is fun.\n"); printf("And programming in C is even more fun\n"); return 0;} 阅读全文
摘要:
#includeint main(void){ int n; int factorial(int n); scanf_s("%d",&n); printf("%d\n",factorial(n)); return 0;}int factorial(int n){ int i,fact=1; for(i=1;i<=n;i++) fact=fact*i; return fact;} 阅读全文
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'); } } 阅读全文
|
Copyright © 2024 haha1235
Powered by .NET 9.0 on Kubernetes |