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