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.
- Prepare
- C++
- Introduction
- Functions
- Discussions
Functions
Functions
Sort by
recency
|
2001 Discussions
|
Please Login in order to post a comment
include
include
using namespace std;
int max_of_four(int a, int b, int c, int 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);
}
include
include
include
using namespace std;
int main(){ int list[4]; for (int i = 0 ; i < 4 ; i++) { cin >> list[i]; } if (list[0] > list[1] && list[0] > list[2] && list[0] > list[3]) { cout << list[0]; } else if (list[1] > list[0] && list[1] > list[2] && list[1] > list[3]) { cout << list[1]; } else if (list[2] > list[0] && list[2] > list[1] && list[2] > list[3]) { cout << list[2]; } else{ cout << list[3]; }
}
include
include
include
using namespace std;
int main(){ int list[4]; for (int i = 0 ; i < 4 ; i++) { cin >> list[i]; } if (list[0] > list[1] && list[0] > list[2] && list[0] > list[3]) { cout << list[0]; } else if (list[1] > list[0] && list[1] > list[2] && list[1] > list[3]) { cout << list[1]; } else if (list[2] > list[0] && list[2] > list[1] && list[2] > list[3]) { cout << list[2]; } else{ cout << list[3]; }
}