Facebook
From adwd, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 203
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double a, b, c, d, max, i;
  14.             Console.WriteLine("***  Program liczy pierwiastki trójmianu kwadratowego  ***");
  15.             Console.WriteLine();
  16.             Console.Write("Podaj a:");
  17.             a = Convert.ToDouble(Console.ReadLine());
  18.             Console.Write("Podaj b:");
  19.             b = Convert.ToDouble(Console.ReadLine());
  20.             Console.Write("Podaj c:");
  21.             c = Convert.ToDouble(Console.ReadLine());
  22.             Console.Write("Podaj d:");
  23.             d = Convert.ToDouble(Console.ReadLine());
  24.             i = 1;
  25.             max = a;
  26.             if (max < b)
  27.             {
  28.                 max = b;
  29.                 i = 2;
  30.             }              
  31.             if (max < c)
  32.             {
  33.                 max = c;
  34.                 i = 3;
  35.             }  
  36.             if (max < d)
  37.             {
  38.                 max = d;
  39.                 i = 4;
  40.             }
  41.  
  42.            
  43.             Console.WriteLine($"a={a}");
  44.             Console.WriteLine($"b={b}");
  45.             Console.WriteLine($"c={c}");
  46.             Console.WriteLine($"d={d}");
  47.             Console.WriteLine($"Maksymalna wartość wynosi {max}");
  48.             Console.WriteLine($"Maksumalną wartością jest licza {i}");
  49.  
  50.             Console.Write("Wciśnij dowolny klawisz");
  51.             Console.ReadKey();
  52.         }
  53.     }
  54. }
  55.