牛刀小试

刚开始学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"); }

posted on 2015-04-09 18:48  Randy77  阅读(130)  评论(0编辑  收藏  举报

导航