摘要:
#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;} 阅读全文
摘要:
#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;} 阅读全文
摘要:
#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;} 阅读全文
摘要:
#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;} 阅读全文
摘要:
#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 阅读全文