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

Write statements that compute and display the absolute difference of two type double variables, x and y, in other words | x – y|SolutionAnswer: abs(x-y) abs(x-y

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site