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.

KarlBreitkopf | 391 |

taruncrrm | 152 |

RABB_RAAKHA | 148 |

mastanbalaji | 147 |

AbhishekGoyal7 | 146 |

bhupinderkumar | 690 |

Liza123 | 690 |

ArushiGarg1 | 689 |

nishant.ns19 | 677 |

vikeshkumar1 | 671 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4785 |

Quandray | 4444 |

Login to report an issue on this page.