#include <stdio.h>
int main()
{
char a,b,c,d,e;
printf("请输入五个字符: ");
a=getchar();
b=getchar();
c=getchar();
d=getchar();
e=getchar();
putchar(a);
putchar(b);
putchar(c);
putchar(d);
putchar(e);
putchar(' ');
return 0;
}
#include <stdio.h>
void main()
{
int year,a;
printf("请输入年份:");
scanf("%d",&year);
if((year%4==0&&year%100!=0)||(year%400==0)) a=1;
else a=0;
if (a==1)
printf(" %d年的二月份有29天 ",year);
else printf("%d年的二月有28天 ",year);
}
#include <stdio.h>
int main(void)
{
int a,b,c,temp;
printf("请输入三角形三边的长:");
scanf("%d%d%d",&a,&b,&c);
if(a<b)
{
temp=a;
a=b;
b=temp;
}
if(a<c)
{
temp=a;
a=c;
c=temp;
}
if(b<c)
{
temp=b;
b=c;
c=temp;
}
if(a<=0||b<=0||c<=0||b+c<=a)
{
printf("该三角形不成立 ");
return 0;
}
if (a==b&&b==c)
{
printf("该三角形是等边三角形 ");
return 0;
}
if((a==b||b==c))
{
printf("该三角形是等腰三角形 ");
return 0;
}
if(a*a==b*b+c*c)
{
printf("该三角形是直角三角形 ");
return 0;
}
printf("该三角形是一般三角形 ");
return 0;
}
#include <stdio.h>
#include <math.h>
int main()
{
double a,rate,tax,profit;
printf("input a");
scanf("%lf",&a);
if (a<500)
{
rate=0.00;
tax=a*rate;
profit=a-tax;
printf("a=%lf ",a);
printf("rate=%lf ",rate);
printf("tax=%lf ",tax);
printf("profit=%lf ",profit);
}
else if(500<=a<1000)
{
rate=0.05;
tax=a*rate;
profit=a-tax;
printf("a=%lf ",a);
printf("rate=%lf ",rate);
printf("tax=%lf ",tax);
printf("profit=%lf ",profit);
}
else if(1000<=a<2000)
{
rate=0.08;
tax=a*rate;
profit=a-tax;
printf("a=%lf ",a);
printf("rate=%lf ",rate);
printf("tax=%lf ",tax);
printf("profit=%lf ",profit);
}
else if(2000<=a<5000)
{
rate=0.10;
tax=a*rate;
profit=a-tax;
printf("a=%lf ",a);
printf("rate=%lf ",rate);
printf("tax=%lf ",tax);
printf("profit=%lf ",profit);
}
else if(5000<=a)
{
rate=0.15;
tax=a*rate;
profit=a-tax;
printf("a=%lf ",a);
printf("rate=%lf ",rate);
printf("tax=%lf ",tax);
printf("profit=%lf ",profit);
}
return 0;
}