(1)、任意输入字符后输出
#includeint main(){ char a,b,c,d,e; a=getchar(); b=getchar(); c=getchar(); d=getchar(); e=getchar(); putchar(a); putchar(b); putchar(c); putchar(d); putchar(e); putchar('\n'); return 0;}
(2)、输入YEAR,输出DAYS
#includeint main(){ int year,days; printf("input the year:"); scanf("%d",&year); if((year%400==0)||(year%4==0&&year%100!=0)) printf("year:%5d,month:2,days:28\n",year); else printf("year:%5d,month:2,days:29\n",year); return 0;}
(3)、三角形
#includeint main(){ int a,b,c; scanf("a=%d,b=%d,c=%d",&a,&b,&c); if(a+b>c&&a+c>b&&b+c>a) { if(a*a+b*b==c*c||b*b+c*c==a*a||a*a+c*c==b*b) printf("直角三角形"); else if(a==b&&b==c&&a==c) printf("等边三角形"); else if(a==b||b==c||a==c) printf("等腰三角形"); else printf("一般三角形"); } else printf("不能构成三角形"); return 0;}
(4)、奖金
#includeint main(){ float a,rate,tax,profit; printf("奖金="); scanf("%f",&a); if(a<500) rate=0; else if(a>=500&&a<1000) rate=0.05; else if(a>=1000&&a<2000) rate=0.08; else if(a>=2000&&a<5000) rate=0.10; else if(a>=5000) rate=0.15; tax=a*rate; profit=a-tax; printf("实得奖金=%.3f\n",profit); return 0;}