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