WiktoriaRatajczyk

Zadanie 3

Mar 22nd, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int WARTOSC_BEZWZGLEDNA(int x){
  6.  
  7. if(x<0) {return -x;}
  8.  
  9. else {return x;}
  10.  
  11. }
  12.  
  13.  
  14. int main()
  15. {
  16.     int x;
  17.     x=3;
  18.     cout<<"Wartosc bezwzgledna z "<<x<<" wynosi "<<WARTOSC_BEZWZGLEDNA(x)<<endl;
  19.     x=-2;
  20.     cout<<"Wartosc bezwzgledna z "<<x<<" wynosi "<<WARTOSC_BEZWZGLEDNA(x)<<endl;
  21.     x=-56;
  22.     cout<<"Wartosc bezwzgledna z "<<x<<" wynosi "<<WARTOSC_BEZWZGLEDNA(x)<<endl;
  23.     return 0;
  24. }
Add Comment
Please, Sign In to add comment