C# - Quadratic Equation Solver - ax2 + bx + c = 0
Find the x, y
using System;
using System.Collection.Generic;
using System.Linq;
using System.Text;
namespace Equation
{
class Program
{
static void Main (string[] args)
{
double a,b,c, sqr, x1, x2;
Console.WriteLine("Enter the value of a");
a= Convert.ToDuble(Console.ReadLine());
Console.WriteLine("Enter the value of b");
b= Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter the value of c");
c= Convert.Todouble(Console.ReadLine());
sqr = (b*b) - ((4)*(a)*(c));
x1 = ((((-1)*(b)) + (sqr))/ ((2)*(a)));
x2 = ((((-1)*(b)) - (sqr))/ ((2)*(a)));
Console.WriteLine("The First value is {0}\n And \n The Second value is {1}", x1,x2);
}
}
}
No comments:
Post a Comment