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