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