Advertisement
PiotrSzewczyk

Zad 3

Mar 24th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int wartosc_bezwzgledna(int a)
  5. {
  6.     if(a<0)
  7.     {
  8.         return -a;
  9.     }
  10.     else return a;
  11. }
  12. int main()
  13. {
  14.     int a;
  15.     cout<<"Podaj liczbe calkowita"<<endl;
  16.     cin>>a;
  17.     cout<<wartosc_bezwzgledna(a)<<endl;
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement