Hello I'm a Beginner in C#. I have made this code for quadratic equation. It runs but does not give the right answer.
using System;
using System.Diagnostics;
namespace mynamespace
{
class myclass
{
static void Main(string[] args)
{
float a, b, c, x1, x2;
Console.Write("Enter Value in a");
a=Convert.ToSingle(Console.ReadLine());
Console.WriteLine("Enter Value in b");
b=Convert.ToSingle(Console.ReadLine());
Console.WriteLine("Enter Value in c");
c=Convert.ToSingle(Console.ReadLine());
x1=(-b + Math.Sqrt ( b*b - 4*a*c)/(2*a));
x2=(-b - Math.Sqrt ( b*b - 4*a*c)/(2*a));
Console.WriteLine(x1);
Console.WriteLine(x2);
Console.ReadKey();
}
}
}