We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
int max_of_four(int a, int b, int c, int d){
int max= a>b ? a:b;
if(c>max)max=c;
return d>max ? d: max;
}
/*
Add int max_of_four(int a, int b, int c, int d) here.
*/
int main() {
int a=3, b=4, c=6, d=5;
cin>>a>>b>>c>>d;
cout<<max_of_four(a,b,c,d)<<endl;
return 0;
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Functions
You are viewing a single comment's thread. Return to all comments →
include
using namespace std;
int max_of_four(int a, int b, int c, int d){ int max= a>b ? a:b; if(c>max)max=c; return d>max ? d: max; } /* Add
int max_of_four(int a, int b, int c, int d)
here. */int main() { int a=3, b=4, c=6, d=5; cin>>a>>b>>c>>d;
}