2-1

#include<stdio.h>

int main(){

int a,b,c,t;

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

if(a<b){

t=a;

a=b;

b=t;

}

if(b>c){

printf("%d\t%d\t%d\n",a,b,c);

}

else if(c>a){

printf("%d\t%d\t%d\n",c,a,b);

}

else{

printf("%d\t%d\t%d\n",a,c,b);

}

return 0;

}

 

 

2-2

#include<stdio.h>

#include<math.h>

int main()

{

int x;

float y;

scanf("%d",&x);

if(x>4){

printf("%f",y=sqrt(x-4));

}

else if(x<-5){

printf("%f",y=fabs(x));

}

else{

printf("%f",y=x+3);

}

return 0;

}

 

2-3

#include<stdio.h>

int main()

{

char temp;

scanf("%c",&temp);

if(temp>='a'&&temp<='z'){

temp-=32;

}

else if('A'<=temp&&temp<='Z'){

temp+=32;

}

printf("%c",temp);

return 0;

}

 

2-4

#include<stdio.h>

#include<math.h>

int main()

{

int x,y;

scanf("%d",&x,&y);

if(x<1){

printf("%d",y=x);

}

else if(x<10&&x>=1){

printf("%d",y=2*x-1);

}

else{

printf("%d",y=3*x-11);

}

return 0;

}

 

 

2-5

#include<stdio.h>

int main()

{

int score;

scanf("%d",&score);

if(score>=90&&score<=100){

printf("A");}

else if(score>=80&&score<=89){

printf("B");}

else if(score>=70&&score<=79){

printf("C");}

else if(score>=60&&score<=69){

printf("D");}

else if(score>=0&&score<=59){

printf("E");}

return 0;

}

 

 

 

posted on 2016-09-27 22:19  李兆嘉  阅读(161)  评论(1编辑  收藏  举报