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