上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要: #includeint main(void){ int i,m; printf("Enter a number:"); scanf("%d",&m); for(i=2;i=m/2&&m!=1) printf("%d is a prime number!\n",m); else printf("No!\n"); return 0;} 阅读全文
posted @ 2013-10-04 18:14 zhaoyang16 阅读(80) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int mynumber=38; int count=0,yournumber; for(count=1;countmynumber) printf("Sorry! yournumber is bigger than mynumber!\n"); } printf("Game is over!\n"); return 0;} 阅读全文
posted @ 2013-10-04 18:14 zhaoyang16 阅读(122) 评论(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 countains %d digits.\n",count); return 0;} 阅读全文
posted @ 2013-10-04 18:12 zhaoyang16 阅读(115) 评论(0) 推荐(0) 编辑
摘要: #include#includeint main(void){ int denominator,flag; double item,pi; flag=1; denominator=1; item=1.0; pi=0; while(fabs(item)>=0.0001){ item=flag*1.0/denominator; pi=pi+item; flag=-flag; denominator=denominator+2; } pi=pi*4; printf("pi=%.4f\n",pi); return 0;} 阅读全文
posted @ 2013-10-04 18:11 zhaoyang16 阅读(132) 评论(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){ printf("Grade average 阅读全文
posted @ 2013-10-04 18:11 zhaoyang16 阅读(111) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ double value1,value2; char op; printf("Type in an expression:"); scanf("%lf%c%lf",&value1,&op,&value2); if(op=='+') printf("=%.2f\n",value1+value2); else if(op=='-') printf("=%.2f\n",value1-value2); else if(o 阅读全文
posted @ 2013-10-03 10:59 zhaoyang16 阅读(155) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int blank,digit,other; char ch; int i; blank=digit=other=0; printf("Enter 10 characters:"); for(i=1;i<=10;i++){ ch=getchar(); switch(ch){ case' ': case'\n': blank++; break; case'0':case'1':case'2':case'3':case'4 阅读全文
posted @ 2013-10-03 10:57 zhaoyang16 阅读(120) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int choice,i; double price; for(i=1;i<=5;i++){ printf("[1]Select crisps\n"); printf("[2]Select popcorn\n"); printf("[3]Select chocolate\n"); printf("[4]Select cola\n"); printf("[0]exit\n"); printf("Enter choice:") 阅读全文
posted @ 2013-10-03 10:56 zhaoyang16 阅读(151) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ double value1,value2; char op; printf("Type in a impression:"); scanf("%lf%lf",&value1,&op,&value2); switch(op){ case'+': printf("=%.2f\n",value1+value2); break; case'-': printf("%.2f\n",value1-value2); break 阅读全文
posted @ 2013-10-03 10:55 zhaoyang16 阅读(145) 评论(0) 推荐(0) 编辑
摘要: # includeint main(void){ double value1,value2; char op; printf("Type in an expression:"); scanf("%lf%c%lf",&value1,&op,&value2); if(op=='+') printf("=%.2f\n",value1 + value2);else if(op=='-')printf("=%.2f\n",value1 -value2);else if( 阅读全文
posted @ 2013-10-03 10:54 zhaoyang16 阅读(158) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 下一页