using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("---ax²+bx+c şeklindeki matematiksel ifadenin köklerini bulan program---");
int a, b, c;
Console.Write("Lütfen ''a'' değerini giriniz : ");
a = int.Parse(Console.ReadLine());
Console.Write("Lütfen ''b'' değerini giriniz : ");
b = int.Parse(Console.ReadLine());
Console.Write("Lütfen ''c'' değerini giriniz : ");
c = int.Parse(Console.ReadLine());
double x1, x2;
double delta;
delta = b * b - 4 * a * c;
x1 = (-b + Math.Sqrt(delta) / (2 * a));
x2 = (-b - Math.Sqrt(delta) / (2 * a));
Console.WriteLine("Girdiğiniz değerlere göre Delta = " + delta);
if (delta < 0)
Console.WriteLine("Girdiğiniz değerlere göre gerçek kökler bulunamadı.");
else
{
Console.WriteLine("Girdiğiniz kökler şunlardır :");
Console.WriteLine("x1 = {0} , x2 = {1}", x1, x2);
}
Console.Write("Programdan çıkmak için lütfen bir tuşa basın..");
Console.ReadKey();
}
}
}
Gerçek Kökler Bulunamadığında
Hiç yorum yok:
Yorum Gönder