码迷,mamicode.com
首页 > 其他好文 > 详细

牛刀小试

时间:2015-04-09 19:26:38      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

刚开始学c,还不了解,花了两个多真是写了书上的五个简单题,慢慢来吗!不积小流,无以成江河
#include "stdio.h" void main() { int c,n; scanf("%d",&n); c=n%2; if(c=0) printf("n is an even"); else printf("n is an odd"); return 0; } #include <stdio.h> #include<stdlib.h> int main() { int x,y; scanf("%d",x); if(-5<x<0) y=x; else if(x=0) y=x-1; else if(0<x<10) y=x+1; return 0; } #include "stdio.h" void main() { long price,taxes; int grade; scanf("%ld",&price); grade=(price-1)/1000; switch(grade) { case 0: printf("taxes==0");break; case 1: case 2: case 3: case 4: printf("taxes==price*0.02");break; case 5: case 6: case 7: case 8: case 9: printf("taxes=price*0.03");break; default: printf("taxes==price*0.05"); } return 0; } #include<stdio.h> #include<stdlib.h> int main() { int n; scanf("%d",&n); if(0<=n&&n<60) printf("BAD"); else if(60<=n&&n<=85) printf("GOOD"); else if(85<n&&n<=100) printf("VERY GOOD"); return 0; system("pause"); } #include<stdio.h> #include<stdlib.h> int main() { int a,b,c,d,x,y,s; scanf("%d%d",&x,&y); a=x/10; b=x%10; c=y/10; d=y%10; s==a*1000+b*10+c*100+d; printf("%d",s); return 0; system("pause"); }

牛刀小试

标签:

原文地址:http://www.cnblogs.com/woderenshengluwozijizou/p/4410506.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!