摘要: #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 resu... 阅读全文
posted @ 2013-10-21 09:31 傻子疯子捏子 阅读(122) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int i,x; double price; for(i=1;i<=5;i++){ printf("[1]apples\n"); printf("[2]pears\n"); printf("[3]oranges\n"); printf("[4]grapes\n"); printf("[0]exit\n"); printf("输入编号:\n"); scanf("%d",&x); if(x==0) 阅读全文
posted @ 2013-10-21 00:24 傻子疯子捏子 阅读(150) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ char op; printf("输入五级制成绩:"); scanf("%c",&op); switch(op){ case'A':printf("grade=90-100"); break; case'B':printf("grade=80-89"); break; case'C':printf("grade=70-79"); break; case'D':printf(&q 阅读全文
posted @ 2013-10-21 00:23 傻子疯子捏子 阅读(127) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int i,n,year; printf("Enter n:"); scanf("%d",&n); for(i=1;i<=n;i++){ printf("Enter year:"); scanf("%d",&year); if((year%4==0&&year%100!=0)||(year%400==0)){ printf("这是闰年"); } else{ printf("这不是闰年"); 阅读全文
posted @ 2013-10-21 00:23 傻子疯子捏子 阅读(87) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int x,y; printf("输入x:"); scanf("%d",&x); if(x<0){ y=-1; } else if(x==0){ y=0; } else{ y=1; } printf("y=%d",y); return 0;} 阅读全文
posted @ 2013-10-21 00:20 傻子疯子捏子 阅读(123) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int digit,space,enter,letter,other; char ch; int i; digit=space=enter=letter=other=0; printf("Enter 15 characters:"); for(i=1;i='a'&&='A'&&='0'&&ch<='9') digit++; else if(ch=' ') space++; else if(ch= 阅读全文
posted @ 2013-10-21 00:20 傻子疯子捏子 阅读(140) 评论(0) 推荐(0) 编辑
摘要: #includeint main (void){ int count,i,n; double grade,total; printf("Enter n:"); scanf("%d",&n); total=0; count=0; for(i=1;i=60){ count++; } } printf("Grade average=%.2f\n",total/n); printf("Number of failures=%d\n",count); return 0;} 阅读全文
posted @ 2013-10-21 00:19 傻子疯子捏子 阅读(94) 评论(0) 推荐(0) 编辑
摘要: #include int main(void) { int i,n; double x; double fact(int n); scanf ("%d", &n); x=0; for(i=0;i<=n;i++){ x=x+fact(i); } printf("x=%.0f\n",x); return 0;}double fact(int n) { int i; double y; y=1; for(i=1;i<=n;i++){ ... 阅读全文
posted @ 2013-10-21 00:19 傻子疯子捏子 阅读(142) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int i,n,numerator,denominator,flag; double sum,item; printf("Enter n:"); scanf("%d",&n); numerator=1; denominator=1; sum=0; flag=1; for(i=1;i<=n;i++){ item=flag*(numerator*1.0/denominator); numerator=numerator+1; denominator... 阅读全文
posted @ 2013-10-21 00:17 傻子疯子捏子 阅读(88) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int n,i; double x,y; y=1; printf("输入n,x:"); scanf("%d%Lf",&n,&x); for(i=1;i<=n;i++){ y=y*x; } printf("y=%Lf",y); return 0;} 阅读全文
posted @ 2013-10-21 00:17 傻子疯子捏子 阅读(83) 评论(0) 推荐(0) 编辑
摘要: #include #include int main(void) { int year; double loan,money,my,rate; scanf("%Lf",&loan); scanf("%Lf",&rate); printf("year money\n"); for(year=5;year<=30;year++){ my=pow(1+rate,12*year); money=loan*rate*my/(my-1); printf("year=%d money=%.0f\n",yea 阅读全文
posted @ 2013-10-21 00:16 傻子疯子捏子 阅读(85) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int m,n; double i,y; y=1; printf("输入m,n的值:"); scanf("%d%d",&m,&n); for(i=m;i<=n;i++){ y=y+(i*i+1/i); } printf("y=%Lf",y); return 0;} 阅读全文
posted @ 2013-10-21 00:16 傻子疯子捏子 阅读(118) 评论(0) 推荐(0) 编辑
摘要: #include#includeint main(void){ int n,i,power; double product; printf("Enter n:"); scanf("%d",&n); product=0; for(i=1;i<=n;i++){ power=pow(2,i); printf("%d",power); product=product+power; } printf("product=%.0f\n",product); return 0;} 阅读全文
posted @ 2013-10-21 00:15 傻子疯子捏子 阅读(99) 评论(0) 推荐(0) 编辑
摘要: #includeint main(void){ int num1,num2,a,b,c; double d,e; printf("输入num1,num2:"); scanf("%d%d",&num1,&num2); a=num1+num2; b=num1-num2; c=num1*num2; d=num1/num2; e=num1%num2; printf("输出和=%d差=%d积=%d商=%.2f余数=%.2f",a,b,c,d,e); return 0;}这个 网出错了 不能上网 所以一起交了 阅读全文
posted @ 2013-10-21 00:12 傻子疯子捏子 阅读(85) 评论(0) 推荐(0) 编辑