Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- float a,b;
- float iloraz(float a, float b)
- {if(a>0 && b>0)
- {return a/b;}
- else
- if (b==0)
- {return -1;}
- else
- {return -2;};
- }
- int main()
- {
- cout<<"podaj liczby do podzielenia"<<endl;
- cin>>a;
- cin>>b;
- if(iloraz(a,b)==-1)
- {cout<<"nie dziel przez zero";}
- else
- if (iloraz(a,b)==-2)
- {cout<<"nie dziel przez zero";}
- else
- {cout<<"iloraz wynosi "<<iloraz(a,b);}
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement