Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. cout << "Podaj a i b" << endl;
  8. double a,b;
  9. cin >> a >>b;
  10. int i;
  11. if (a!=0 && b!=0)
  12. {
  13. if (a>b)
  14. {
  15. for (i = 1; a!=b; i++)
  16. a=a-b;
  17. }
  18. else
  19. if (b>a)
  20. {
  21. for (i=1; b!=a; i++)
  22. b=b-a;
  23. }
  24.  
  25. cout << i;
  26. }
  27. else
  28. {
  29. cout << "Nie dziel przez zero!";
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement