Skip to content

Instantly share code, notes, and snippets.

@fuwiak
Created May 25, 2020 20:43
Show Gist options
  • Save fuwiak/e73298b3438eaa66e7123eff0f439389 to your computer and use it in GitHub Desktop.
Save fuwiak/e73298b3438eaa66e7123eff0f439389 to your computer and use it in GitHub Desktop.
#include<iostream>
using namespace std;
int wartosc_bezwgledna(int x){
if(x>=0)
return x;
else
return -x;
}
int main(){
int liczba1;
int liczba2;
liczba1=-9;
liczba2=77;
cout <<"wartosc bezwgledna z liczby "<< liczba1 <<" wynosi " << wartosc_bezwgledna(liczba1) << endl;
cout <<"wartosc bezwgledna z liczby "<< liczba2 <<" wynosi " << wartosc_bezwgledna(liczba2) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment