Sort by

recency

|

1975 Discussions

|

  • + 0 comments

    include

    include

    using namespace std;

    int max_of_four(int a, int b, int c, int d){ int max = 0;

        if (a >= max){
            max = a;
        }
        if (b >= max){
            max = b;
        }
        if (c >= max){
            max = c;   
        }
        if (d >= max){
            max = d;
        }
        return max;
    

    }

    int main() { int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d); int ans = max_of_four(a, b, c, d); printf("%d", ans);

    return 0;
    

    }

  • + 0 comments

    YOU HAVE TO STORE GRT NUM IN INT AND THEN RETURN IT

    include

    include

    using namespace std;

    /* Add int max_of_four(int a, int b, int c, int d) here. */ int max_of_four(int a, int b, int c, int d) { int great; if( a>b && a>c && a>d) { great =a; } else if(b>a && b>c && b>d) { great =b; } else if(c>a && c>b && c>d) { great = c; } else{

        great = d;
         }
    return great ;
    

    }

  • + 0 comments
    int max_of_four(int a, int b, int c, int d){
        int list[] {a,b,c,d};
        int tam = sizeof(list)/ sizeof(int);
        int temp;
        for (int i = 0; i <= tam; i++) {
            if(list[i] > temp){ 
                temp = list[i];
                };
        }
        return temp;
    }
    
  • + 0 comments

    include

    include

    using namespace std;

    int max_of_four(int a, int b, int c, int d) {

    return max(max(a,b),max(c,d));
    

    }

    int main() {

    int a;
    int b;
    int c;
    int d;
    cin>>a>>b>>c>>d;
    cout<<max_of_four(a,b,c,d);
    
    
    return 0;
    

    }

  • + 0 comments

    int max_of_four(int a,int b,int c,int d){ int answ = max({a,b,c,d}); return answ; }