实验2
#include<stdio.h>
int 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);
return 0;
}
#include<stdio.h>
int main()
{
int year,i,j;
printf("Input the year");
scanf("%d",&year);
if(year%400==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))
{
printf("等边三角形");
}
else if((a*a+b*b==c*c)||(a*a+c*c==b*b)||(b*b+c*c==a*a))
{
printf("直角三角形");
}
else if((a==b)||(a==c)||(b==c))
{
printf("等腰三角形");
}
else
{
printf("一般三角形");
}
}
else
{
printf("不能构成三角形");
}
return 0;
}
#include<stdio.h>
int main()
{
int a;
double rate,tax,profit;
scanf("%d",&a);
if(a<500)
{
printf("a=%d,rate=0,tax=0,profit=%f",a,a);
}
else if((a>=500)&&(a<1000))
{
tax=a*0.05;
profit=a*0.95;
printf("a=%d,rate=0.05,tax=%f,profit=%f",a,tax,profit);
}
else if((a>=1000)&&(a<2000))
{
tax=a*0.08;
profit=a*0.92;
printf("a=%d,rate=0.08,tax=%f,profit=%f",a,tax,profit);
}
else if((a>=2000)&&(a<5000))
{
tax=a*0.10;
profit=a*0.90;
printf("a=%d,rate=0.10,tax=%f,profit=%f",a,tax,profit);
}
else
{
tax=a*0.15;
profit=a*0.85;
printf("a=%d,rate=0.15,tax=%f,profit=%f",a,tax,profit);
}
return 0;
}