Advertisement
Pietras286

Równanie kwadratowe

Dec 13th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. namespace Problem24
  2. {
  3.     class Program
  4.     {
  5.         public static void Main(string[] args)
  6.         {
  7.             string liczby;
  8.             while ((liczby = Console.ReadLine()) != null)
  9.             {
  10.                 string[] tab = liczby.Split(' ');
  11.                 float a = float.Parse(tab[0]);
  12.                 float b = float.Parse(tab[1]);
  13.                 float c = float.Parse(tab[2]);
  14.                 float delta = b * b - 4 * a * c;
  15.                 if (delta > 0)
  16.                 {
  17.                     Console.WriteLine("2");
  18.                 }
  19.                 else if (delta == 0)
  20.                 {
  21.                     Console.WriteLine("1");
  22.                 }
  23.                 else
  24.                 {
  25.                     Console.WriteLine("0");
  26.                 }
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement