实验二

#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;

printf("input the year:");

scanf("%d",&year);

if((year%4==0&&year%100!=0)||year%400==0)

printf("year:%d,month:2,days:29",year);

else

printf("year:%d,month:2,days:28",year);                                                                                          

return 0;}

#include<stdio.h>

void sanjiaoxing(int a,int b,int c);

int main(){

int a,b,c;

scanf("%d,%d,%d",&a,&b,&c);

sanjiaoxing(a,b,c);

return 0;

}

void sanjiaoxing(int a,int b ,int c){

if((a+b>c)&&(b+c>a)&&(a+c>b))

{

if((a*a+b*b)==c*c)

    printf("直角三角形\n");

else if((a==b)||(b==c)||(a==c))

{

    if((a==b)&&(a==c))

        printf("等边三角形\n");

    else

        printf("等腰三角形\n");

}

 else   printf("一般三角形\n");

}

else

printf("error!!!!!!!!!!!!!!!!!!!!!!!!!\n");

}

#include<stdio.h>

void w(int a){

double rate,tax,profit;

if(a<500)

{rate=0.00;

tax=a*rate;

profit=a-a*rate;

printf("a=%d,rate=%f,tax=%f,profit=%f\n",a,rate,tax,profit);

}

else if(a>=500&&a<1000)

{rate=0.05;

tax=a*rate;

profit=a-a*rate;

printf("a=%d,rate=%f,tax=%f,profit=%f\n",a,rate,tax,profit);

}

else if(a>=1000&&a<2000)

{rate=0.08;

tax=a*rate;

profit=a-a*rate;

printf("a=%d,rate=%f,tax=%f,profit=%\nf",a,rate,tax,profit);

}

else if(a>=2000&&a<5000)

{rate=0.10;

tax=a*rate;

profit=a-a*rate;

printf("a=%d,rate=%f,tax=%f,profit=%f\n",a,rate,tax,profit);

}

else

{rate=0.15;

tax=a*rate;

profit=a-a*rate;

printf("a=%d,rate=%f,tax=%f,profit=%f\n",a,rate,tax,profit);

}

}

int main(){

int a;

scanf("%d",&a);

w(a);

return 0;

}

 

posted on 2019-04-22 15:18  p201821440025  阅读(109)  评论(0编辑  收藏  举报