zoukankan      html  css  js  c++  java
  • 作业

    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 %d %d ",a,b,c);

    }

    else if(c>a){

    printf("%d %d %d ",c,a,b);

    }

    else{

    printf("%d %d %d ",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;

    }

     

  • 相关阅读:
    Lua 的元表怎么理解
    Lua中的元表与元方法
    Lua 的元表怎么理解
    VMware Workstation 系统备份-虚拟机克隆方法
    Lua中的元表与元方法
    bzoj2809
    bzoj2733
    bzoj1334
    bzoj1211
    bzoj3083 3306
  • 原文地址:https://www.cnblogs.com/lzjww/p/5914550.html
Copyright © 2011-2022 走看看