Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include <iostream>
- using namespace std;
- int MAX (int n1, int n2, int n3)
- {
- if(n1>=n2&&n1>=n3)
- {
- return n1;
- }
- else if(n2>=n1&&n2>=n3)
- {
- return n2;
- }
- else if(n3>=n2&&n3>=n1)
- {
- return n3;
- }
- }
- int main()
- {
- int n1,n2,n3;
- cout << "Podaj pierwsza liczbe naturalna: " << endl;
- cin >> n1;
- cout << "Podaj druga liczbe naturalna: " << endl;
- cin >> n2;
- cout << "Podaj trzecia liczbe naturalna: " << endl;
- cin >> n3;
- if(n1>=1&&n2>=1&&n3>=1)
- {
- cout << "Najwieksza liczba: " << MAX(n1,n2,n3);
- }
- else
- {
- cout << "Ktoras z podanych liczb nie jest naturalna.";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement