Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a,b,c,d;
- int MAX(int a, int b, int c)
- {
- if(a<0 || b<0 || c<0)
- {
- return 0;
- }
- if(a>b && a>c)
- {
- d = a;
- }
- if(b>a && b>c)
- {
- d = b;
- }
- if(c>a && c>b)
- {
- d = c;
- }
- if(a==b || b==c)
- {
- return a;
- }
- return d;
- }
- int main()
- {
- cout << "Podaj 3 liczby naturalne" << endl;
- cin >> a >> b >> c;
- cout<<"Najwieksza z nich to: "<<MAX(a,b,c);
- return 0;
- }
Add Comment
Please, Sign In to add comment