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.

hari32147 | 100 |

AtakanSarıoğlu | 83 |

geetyadav | 82 |

amitpandey19 | 81 |

AdityaRaj9 | 75 |

abducodes | 862 |

harshtyagi36 | 425 |

vamsikrishna55 | 323 |

sandipbhaumik | 321 |

arpit_anshuman | 319 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.