Created
February 2, 2017 15:46
-
-
Save Adals20/e30d87feb3da31017f54e729cba6975d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int minimunThree(int x, int y, int z){ | |
if (y>=x && z>=x) | |
return (x); | |
else if(y<=x && y<=z) | |
return (y); | |
else if (z<=x && z<=y) | |
return (z); | |
} | |
int sumSquares(int x, int y, int z){ | |
int x2 = x*x; | |
int y2 = y*y; | |
int z2 = z*z; | |
int s = x2+y2+z2; | |
return (s); | |
} | |
int main(){ | |
int x,y,z,a,b; | |
cout << "Introdusca el primer numero: "; | |
cin >> x; | |
cout << "Introdusca el segundo numero: "; | |
cin >> y; | |
cout << "Introdusca el tercer numero: "; | |
cin >> z; | |
a = minimunThree(x,y,z); | |
cout << "El numero menor es: " << a << endl; | |
b = sumSquares(x,y,z); | |
cout << "La suma de los cuadrados es: " << b << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment