Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int nombre;
- int valabs;
- cout<<"nombre? "<<endl;
- cin>>nombre;
- valabs=nombre;
- //si nombre est negatif on le multiplie -1 sinon on le laisse comme ca.
- if(nombre<0){
- valabs=nombre*(-1);
- }
- cout<<"valeur absolue="<<valabs;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement