INPUT:
using System;
using System.Collections.Generic;
using System.Text;
namespace a
{
class quadraticformula
{
double squareofb(double
b)
{
double value = b * b;
return value;
}
double x1(double a, double b, double c)
{
double ac4=4*a*c;
double b1 =Math.Sqrt(squareofb(b)-ac4);
double x = ((-b+b1 )/(2*a));
return x;
}
double x2(double a, double b, double c)
{
double ac4=4*a*c;
double b1= Math.Sqrt(squareofb(b)-ac4);
double x =((-b-b1)/(2*a));
return x;
}
static void Main(string[] args)
{
double a, b, c;
Console.WriteLine("plz input the value of a");
a
= Convert.ToDouble(Console.ReadLine());
Console.WriteLine("plz
input the value of b");
b
= Convert.ToDouble(Console.ReadLine());
Console.WriteLine("plz
input the value of c");
c
= Convert.ToDouble(Console.ReadLine());
quadraticformula q = new
quadraticformula();
Console.WriteLine("x1={0}",
q.x1(a,b,c));
Console.WriteLine("x2={0}",
q.x2(a, b, c));
}
}
}
No comments:
Post a Comment