Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.0 kB
2
Indexable
Never

using System;

public class HelloWorld
{
    public static void Main()
    {
        Console.WriteLine("write a");
        var a = Console.ReadLine();
        
        Console.WriteLine("write b");
        var b = Console.ReadLine();
        
        Console.WriteLine("write c");
        var c = Console.ReadLine();
        
        double ad = Convert.ToDouble(a);
        double bd = Convert.ToDouble(b);
        double cd = Convert.ToDouble(c);
        
        double disc = (bd*bd)-4*(ad)*(cd);
        Console.WriteLine(disc);

         
        if(disc == 0){
            double x1 = ((-bd)+(Math.Sqrt(disc)))/(2d*ad);
            Console.WriteLine($"x = {x1}");
        }else if(disc > 0){
            double x1 = ((-bd)+(Math.Sqrt(disc)))/(2d*ad);
            Console.WriteLine($"x1 = {x1}");
            double x2 = ((-bd)-(Math.Sqrt(disc)))/(2d*ad);
            Console.WriteLine($"x2 = {x2}");
        }else if(disc < 0){
            Console.WriteLine("Korney Net");
        }
        
        
        
        
       
    }
}