Advertisement
Guest User

Untitled

a guest
Jun 27th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int nombre;
  8. int valabs;
  9. cout<<"nombre? "<<endl;
  10. cin>>nombre;
  11. valabs=nombre;
  12.  
  13. //si nombre est negatif on le multiplie -1 sinon on le laisse comme ca.
  14. if(nombre<0){
  15. valabs=nombre*(-1);
  16. }
  17. cout<<"valeur absolue="<<valabs;
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement