+ 1
how do i make this code display the answer in positive (+) even if the answer is in negative.
#include <iostream> using namespace std; int a=4; int b=10; cout<<a-b; // I know the real answer is -6 but I want the answer displayed in positive(+). How do I do it?//
2 Answers
+ 7
#include <cmath>
cout<<abs(a-b);
+ 2
cout <<abs (a-b)
import cmath file