摘要: #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;} 阅读全文
posted @ 2013-10-02 23:57 傻子疯子捏子 阅读(111) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int denominator,flag,i,n; double item,sum; printf("Enter n:"); scanf("%d",&n); flag=1; denominator=1; sum=0; for(i=1;i<=n;i++){ item=flag*1.0/denominator; sum=sum+item; flag=-flag; denominator=denominator+2; } printf("... 阅读全文
posted @ 2013-10-02 23:49 傻子疯子捏子 阅读(126) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int i,n,sum; printf("Enter n:"); scanf("%d",&n); sum=0; for(i=1;i<=n;i++){ sum=sum+1; } printf("Sum of numbers from 1 to %d is %d\n",n,sum); return 0;} 阅读全文
posted @ 2013-10-02 23:42 傻子疯子捏子 阅读(116) 评论(0) 推荐(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) 阅读全文
posted @ 2013-10-02 23:37 傻子疯子捏子 阅读(103) 评论(0) 推荐(0) 编辑
摘要: #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("%lf,&rate:"); sum=money*pow(1+rate,year); print 阅读全文
posted @ 2013-10-02 23:30 傻子疯子捏子 阅读(105) 评论(0) 推荐(0) 编辑
摘要: /*计算二分段函数*/#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;}在做程序的时候 老是出错 总结了一下几点原因1.忘记打分号2.全角半角弄错3.单词拼错心得1.有些单词 打完之后会变成 蓝色 可以确定 是否打错 如:#include. 阅读全文
posted @ 2013-10-02 23:20 傻子疯子捏子 阅读(132) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int celsius,fahr; fahr=100; celsius=5*(fahr-32)/9; printf("fahr=%d,celsius=%d\n",fahr,celsius); return 0;} 阅读全文
posted @ 2013-10-02 19:48 傻子疯子捏子 阅读(100) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ printf("Progamming is fun.\n"); printf("And programming in C is even more fun!\n"); return 0;} 阅读全文
posted @ 2013-10-02 19:33 傻子疯子捏子 阅读(135) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ printf("Hello World!\n"); return 0;} 阅读全文
posted @ 2013-10-02 19:28 傻子疯子捏子 阅读(114) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int n; int factorial(int n); scanf("%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;} 阅读全文
posted @ 2013-10-02 19:22 傻子疯子捏子 阅读(149) 评论(0) 推荐(0) 编辑