Biggest and smallest of four integers (No arrays, no functions, fewest 'if' statements)

后端 未结 18 2508
北海茫月
北海茫月 2020-12-10 11:29

You see, I\'ve self-taught myself C++ (not completely, I\'m still procrastinating -_-). So, now I started university and they\'re teaching C and they made us do a program of

18条回答
  •  温柔的废话
    2020-12-10 11:50

    Try something like this

    int main(void) {
        int a=-2,b=-3,c=-4,d=-5;
        int max=a,min=a;
    
        if(b>max){
            max=b;
        }else if(bmax){
            max=c;
        }else if(cmax){
            max=d;
        }else if(d

    Demo

提交回复
热议问题