标签:get else print 9.png getc tchar case stdio.h std
一
#include<stdio.h>
int main(){
putchar(getchar());
putchar(getchar());
putchar(getchar());
putchar(getchar());
putchar(getchar());
return 0;
}
二
#include<stdio.h>
int main(){
int year;
printf("input the year");
scanf("%d",&year);
if(((year%100!=0)&&(year%4==0))||(year%100==0)){
printf("year:%d month:2 days:29",year);
}else{
printf("year:%d month:2 days:28",year);
}
return 0;
}
三
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a+b>c&&a+c>b&&b+c>a){
if((a==b&&a!=c)||(a==c&&a!=b)||(b==c&&a!=b)){
if((a*a+b*b==c*c)||(b*b+c*c==a*a)||(a*a+c*c==b*b)){
printf("是等腰直角三角形");
}else{
printf("是等腰三角形");
}
}else if(a==b&&a==c){
printf("是等边三角形");
}else if((a*a+b*b==c*c)||(b*b+c*c==a*a)||(a*a+c*c==b*b)){
printf("是直角三角形");
}else{
printf("是一般三角形");
}
}else{
printf("不是");
}
return 0;
}
四
#include<stdio.h>
int main(){
int a;
int t;
double rate,tax,profit;
scanf("%d",&a);
if(a<500){
rate=0.00;
t=1;
}else if(a>=500&&a<1000){
rate=0.05;
t=2;
}else if(a>=1500&&a<2000){
rate=0.08;
t=3;
}else if(a>=2000&&a<5000){
rate=0.10;
t=4;
}else{
rate=0.15;
t=5;
}
switch(t){
case 1 :printf("rate=%.2f,tax=%.2f,prifit=%.2f",rate,rate*a,a*(1-rate));break;
case 2 :printf("rate=%.2f,tax=%.2f,prifit=%.2f",rate,rate*a,a*(1-rate));break;
case 3 :printf("rate=%.2f,tax=%.2f,prifit=%.2f",rate,rate*a,a*(1-rate));break;
case 4 :printf("rate=%.2f,tax=%.2f,prifit=%.2f",rate,rate*a,a*(1-rate));break;
case 5 :printf("rate=%.2f,tax=%.2f,prifit=%.2f",rate,rate*a,a*(1-rate));break;
}
return 0;
}
标签:get else print 9.png getc tchar case stdio.h std
原文地址:https://www.cnblogs.com/p201821440014/p/10749744.html