Find the output of the following code.
#include<math.h>
#include<iostream.h>
using namespace std;
void distance(float x, float y, float a, float b, float c)
{
float d = fabs((a * x + b * y + c)) / (sqrt(a * a + b * b));
cout<<d;
return;
}
int main()
{
float x = -2;
float y = -3;
float a = 5;
float b = -2;
float c = - 4;
distance(x, y, a, b, c);
return 0;
}
#include<math.h>
#include<iostream.h>
using namespace std;
void distance(float x, float y, float a, float b, float c)
{
float d = fabs((a * x + b * y + c)) / (sqrt(a * a + b * b));
cout<<d;
return;
}
int main()
{
float x = -2;
float y = -3;
float a = 5;
float b = -2;
float c = - 4;
distance(x, y, a, b, c);
return 0;
}
A. 2.8
B. 1.8
C. 1.4
D. 2.4
Answer: Option C
Join The Discussion