Advertisement
Majus2137

Zad5 - if

Nov 16th, 2020
60
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.  
  3. using namespace std;
  4.  
  5. int pierwsza;
  6. int druga;
  7. int trzecia;
  8. int czwarta;
  9.  
  10. int main()
  11. {
  12. cout<<"Podaj pierwsza liczbe: ";
  13. cin>>pierwsza;
  14. cout<<"Podaj druga liczbe: ";
  15. cin>>druga;
  16. if (pierwsza < 0)
  17. {
  18. trzecia = pierwsza * -1;
  19. }
  20. if (druga < 0)
  21. {
  22. czwarta = druga * -1;
  23. }
  24. if (trzecia > czwarta)
  25. {
  26. cout<<"Wieksza liczba bezwzgledna jest "<<pierwsza;
  27. }
  28. else if (trzecia < czwarta)
  29. {
  30. cout<<"Wieksza liczba bezwzgledna jest "<<druga;
  31. }
  32. else if ( pierwsza == druga)
  33. {
  34. cout<<"Obie liczby sa sobie rowne";
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement