Write statements that compute and display the absolute diffe
Write statements that compute and display the absolute difference of two type double variables, x and y, in other words | x – y|
Solution
Answer: abs(x-y)
abs(x-y) statement that compute and display the absolute difference of two type double variables, x and y
Below is the example for the same.
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double x = 5, y =10;
cout<<abs(x-y)<<endl;
return 0;
}
Output:
5
