*Author:* Aryan KD

*Tester:* Aryan KD

*Editorialist:* Aryan KD

# DIFFICULTY:

CAKEWALK, SIMPLE, EASY.

# PREREQUISITES:

Math .

# PROBLEM:

You have given a quadratic equation you have to find a nature of root in it. you have given three coefficient A,B,C of a quadratic equation AX^2+BX+C . nature of root is depend on the value of discriminant which is equal to (B^2-4 x A x C) where A is first term B is 2nd term and C is 3rd term of equation

there is 3 type of root can be possible

- 1 imaginary : if the value of discriminant less than 0 .
- 2 real : if the value of discriminant greater than 0 .
- 3 equal : if the value of discriminant is equal to 0 .

# EXPLANATION:

We have just given three numbers that is A , B and C we have to find value of discriminant and we have to compare it from 0 if the given values is equal to 0 then we have to print equal

if the value of discriminant less than 0 then print imaginary and if the value of discriminant greater than 0 print real

value of discriminant is found by given formula B^2 - 4*A*C

for example 3 8 4

here A=3 B=8 C=4

value of discriminant is B^2-4xAxC = 8^2-4x3x4 = 16 that is greater than 0 there for output is real

# SOLUTIONS:

## Setter's Solution

#include<bits/stdc++.h>

using namespace std;

void testcase()

{

int a,b,c;

cin>>a>>b>>c;

int d= (b*b)-(4*a*c);

if(d<0){

cout<<“imaginary”;

}

else if(d==0){

cout<<“equal”;

}

else{

cout<<“real”;

}

}

int main()

{

int t;

cin>>t;

while(t–)

{

testcase();

cout<<endl;

}

return 0;

}

## Tester's Solution

#include<bits/stdc++.h>

using namespace std;

void testcase()

{

int a,b,c;

cin>>a>>b>>c;

int d= (b*b)-(4*a*c);

if(d<0){

cout<<“imaginary”;

}

else if(d==0){

cout<<“equal”;

}

else{

cout<<“real”;

}

}

int main()

{

int t;

cin>>t;

while(t–)

{

testcase();

cout<<endl;

}

return 0;

}

## Editorialist's Solution

#include<bits/stdc++.h>

using namespace std;

void testcase()

{

int a,b,c;

cin>>a>>b>>c;

int d= (b*b)-(4*a*c);

if(d<0){

cout<<“imaginary”;

}

else if(d==0){

cout<<“equal”;

}

else{

cout<<“real”;

}

}

int main()

{

int t;

cin>>t;

while(t–)

{

testcase();

cout<<endl;

}

return 0;

}