Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- // Karol Woźniak 18.03.2020r
- using namespace std;
- int liczba1,liczba2;
- float ILORAZ(float a, float b)
- {
- if(b==0)
- {
- return -1;
- }
- else if((a<0) || (b<0))
- {
- return -2;
- }
- else
- {
- return a/b;
- }
- }
- int main()
- {
- cout << "Podaj dwie liczby do dzielenia" << endl;
- cin >> liczba1 >> liczba2;
- if(ILORAZ(liczba1, liczba2)==-1)
- {
- cout << "Nie dziel przez 0";
- }
- else if(ILORAZ(liczba1, liczba2)==-2)
- {
- cout << "Tylko dodatnie liczby!";
- }
- else
- {
- cout << ILORAZ(liczba1, liczba2);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement