# Quadratic Formula/ Quadratic Equation Solver Visual Basic, VB.net

**Description:**Remember Quadratic equation/Quadratic formula from high school maths? Something that solves equation in one variable of the form "x^2 + 2x + 1 = 0". Using this project, you dont need to solve that equation on paper anymore. This project simply asks for three coefficients "a" , "b" , "c" and solves the equation.

**Difficulty:** Easy

**Language: **Visual Basic.NET (VB.NET)

**Compiler/IDE: ** Visual Studio

Module Module1 Sub Main() Dim a, b, c As Single Console.WriteLine("Write coefficient 'a'") a = Console.ReadLine Console.WriteLine("Write coefficient 'b'") b = Console.ReadLine Console.WriteLine("Write coefficient 'c'") c = Console.ReadLine Dim d As Integer = b ^ 2 - 4 * a * c If d >= 0 Then If d = 0 Then Console.WriteLine("Roots are real and equal") Else Console.WriteLine("Roots are real and different") End If Console.Write("Roots are: ") Console.Write((-b + d ^ 0.5) / (2 * a) & " , ") Console.WriteLine((-b - d ^ 0.5) / (2 * a)) Else Console.WriteLine("Roots are complex") Console.Write("Roots are: ") Console.Write(-b / (2 * a) & "+" & (d * -1) ^ 0.5 / (2 * a) & "i") Console.Write(" , ") Console.WriteLine(-b / (2 * a) & "-" & (d * -1) ^ 0.5 / (2 * a) & "i") End If Console.ReadLine() End Sub End Module

**
Notes:**This project uses the quadratic formula: " (-b + (sqrt( b^2 - 4ac )) / 2a) " and " (-b -( sqrt(b^2 - 4ac)) / 2a) " for solving the roots of the equation, where "sqrt" represents "Square Root". For complex roots, it displays the roots in proper notation using "i" as the imaginary variable.