2013年10月8日
摘要: #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-08 06:20 yy99 阅读(145) 评论(0) 推荐(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-08 06:19 yy99 阅读(151) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int mark,max; printf("Enter marks:"); scanf("%d",&mark); max=mark; 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-08 06:17 yy99 阅读(148) 评论(0) 推荐(0) 编辑
  2013年10月7日
摘要: #includeint main(void){ int i,mark,max,n; printf("Enter n:"); scanf("%d",&n); printf("Enter %d marks:",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); 阅读全文
posted @ 2013-10-07 22:48 yy99 阅读(102) 评论(0) 推荐(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-07 22:42 yy99 阅读(88) 评论(0) 推荐(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-07 22:36 yy99 阅读(106) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int mynumber=38; int count=0,yournumber; for(count=1;countmynumber) printf("Sorry!your number is bigger than my number!\n"); else printf("Sorry!your number is smaller than my number\n"); } printf("Game is over!\n"); return 0;} 阅读全文
posted @ 2013-10-07 22:22 yy99 阅读(130) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int i,m; printf("Enter anumber:"); scanf("%d",&m); for(i=2;im/2&&m!=1) printf("%d is a prime number!\n",m); else printf("NO!\n"); return 0;} 阅读全文
posted @ 2013-10-07 22:03 yy99 阅读(135) 评论(0) 推荐(0) 编辑
摘要: #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-07 21:55 yy99 阅读(76) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int count,num; double grade,total; num=0; total=0; count=0; printf("Enter grades:"); scanf("%lf",&grade); while(grade>=0){ total=total+grade; num++; if(grade<60) count++; scanf("%lf",&grade); } if(num!=0){ ... 阅读全文
posted @ 2013-10-07 21:43 yy99 阅读(123) 评论(0) 推荐(0) 编辑