Associated Course(s):
Fundamentals of Programming with C

Given a quadratic equation in the form **ax ^{2} + bx + c**. The task is to find the

**Input: **

First line of input contains an integer, the number of test cases **T**. Each test case should contain three positive numbers **a, b and c** in the same line seperated by space.

**Output: **

If roots of equations exists, then print the two roots separated by space (Higher valued root should be printed before lower valued). Else if a = 0, then print "**Invalid**" as equation is not quadratic. If roots are imaginary, then print "**Imaginary**"

**Constraints:**

1 <= T <= 50

-10^{3} <= a <= 10^{3}

-10^{3} <= b <= 10^{3}

-10^{3} <= c <= 10^{3}

**Example:**

**Input:**

3

1 -2 1

1 -7 12

1 4 8

**Output:**

1 1

4 3

Imaginary

**Explanation:
Testcase 1: **Roots of equation x

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Akkki111 | 38 |

SaltBaeSama | 34 |

ambercyrus | 33 |

LegendFire | 32 |

chocozz | 32 |

KshatriyaYash | 1932 |

nikhil_sojan | 1374 |

lonecoder | 1219 |

mazumderrohit8 | 1095 |

SumitSingh27 | 1090 |

blackshadows | 5327 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4566 |

Quandray | 4444 |

Login to report an issue on this page.