Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- //Precondició: Llegeix 3 enters
- //Postcondició: Retorna la suma del màxim i el mínim
- int main() {
- int x, y, z, max, min;
- cin >> x;
- max = x;
- cin >> y;
- if (y > x) {
- max = y;
- min = x;
- }else min = y;
- cin >> z;
- if (z > max) max = z;
- else if (z < min) min = z;
- cout << max + min << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement