Advertisement
Lukasz_Miskiewicz

Zadanie 6

Mar 24th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5. int iloraz()
  6. {
  7. int a, b;
  8. cout<<"podaj naturalne liczby do ilorazu"<<endl;
  9. cin>>a;
  10. cin>>b;
  11. if (a<=0)
  12. {
  13. (a=-2);
  14. }
  15. if (b<=0)
  16. {
  17. (b=-1);
  18. }
  19.  
  20. if (a<=-2)
  21. {
  22. cout<<"nie dziel przez zero!";
  23. return 0;
  24. }
  25. if (b<=-1)
  26. {
  27. cout<<"nie dziel przez zero!";
  28. return 0;
  29. }
  30. else
  31. {
  32. cout<<"wynik dzielenia to ";
  33. cout<<(a/b)<<endl;
  34.  
  35. }}
  36.  
  37. int main()
  38. {
  39. iloraz();
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement