Sort by

recency

|

2015 Discussions

|

  • + 0 comments

    int max_of_four(int a, int b, int c, int d) { int maxValue,temp1,temp2 = 0; temp1 = a>b?a:b; temp2 = c>d?c:d; return maxValue = temp1>temp2?temp1:temp2; }

  • + 0 comments
    int max_of_four(int a, int b, int c, int d) {
        return max({a,b,c,d});
    }
    
    int main() {    
        int a,b,c,d;
        
        cin >> a >> b >> c >> d;
        cout << max_of_four(a, b, c, d) << endl;
        return 0;
    }
    
  • + 0 comments

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

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

    } int main() {

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

    }

  • + 0 comments

    include

    include

    using namespace std;

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

    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
    int max_of_four(int a, int b, int c, int d) {
        int result = 0;
        int values[4] = {a, b, c, d};
        for (int i = 0; i < 4; i++) {
            if (values[i] > result) {
                result = values[i];
            }
        }
        return result;
    
    }