Facebook
From pat, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 130
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ppproj0910
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             /*          
  14.                        string imie;
  15.                         Console.Write("Podaj imię: ");
  16.                         imie = Console.ReadLine();
  17.                         Console.WriteLine("Hi "+imie);
  18.             */
  19.  
  20.             /*
  21.                         Console.WriteLine("Program oblicza pole prostokąta");
  22.                         double bokA, bokB, pole;
  23.                         Console.WriteLine("Podaj bok A: ");
  24.                         bokA = double.Parse(Console.ReadLine());
  25.                         Console.WriteLine("Podaj bok B: ");
  26.                         bokB = double.Parse(Console.ReadLine());
  27.                         //bokA = 10.5; bokB = 20;
  28.                         pole = bokA * bokB;
  29.                         Console.WriteLine("Pole prostokąta o boku " +bokA+ " oraz " +bokB+ " wynosi: " +pole+"jednostek[2]");
  30.             */
  31.  
  32.             /*
  33.             Console.WriteLine("Program oblicza objętość kuli o promieniu podanym przez użytkownika.");
  34.             Console.Write("Podaj promień: ");
  35.             double r = double.Parse(Console.ReadLine());
  36.             double V = (4*Math.PI * Math.Pow(r, 3)) /3;
  37.             Console.WriteLine("Objętość kuli o promieniu " + r + " jednostek wynosi: " + V + " jednostek[3]");
  38.             Console.WriteLine("Objętość kuli o promieniu wynosi r = {0} jednostek wynosi V = {1} jednostek[3]", r, V);
  39.             */
  40.  
  41.             /*Console.WriteLine("Program przelicza kwotę EUR na PLN po określonym kursie.");
  42.             try
  43.             {
  44.                 double EUR = 4.9;
  45.                 Console.Write("Podaj ile Euro chcesz wymienić: ");
  46.                 double ilosc = double.Parse(Console.ReadLine());
  47.                 double PLN = EUR * ilosc;
  48.                 Console.WriteLine("Wymieniasz na " + PLN + " złotych.");
  49.             }
  50.             catch (Exception e) // "e" to zmienna do wyjątku
  51.             {
  52.                 Console.WriteLine("Coś poszło nie tak ... " + e.Message);
  53.             }
  54.             */
  55.  
  56.             /*
  57.             Console.WriteLine("Program sprawdza czy liczba jest większa, mniejsza albo równa 5 ");
  58.             Console.Write("Podaj liczbę: ");
  59.             double liczba = double.Parse(Console.ReadLine());
  60.  
  61.             if (liczba % 2 == 0)
  62.             {
  63.                 Console.WriteLine("Liczba jest parzysta.");
  64.                 if (liczba > 5)
  65.                 {
  66.                     Console.WriteLine("Liczba {0} jest większa od 5", liczba);
  67.                 }
  68.                 else if (liczba == 5)
  69.                 {
  70.                     Console.WriteLine("Liczba {0} jest równa 5", liczba);
  71.                 }
  72.                 else
  73.                 {
  74.                     Console.WriteLine("Liczba {0} jest mniejsza od 5 ", liczba);
  75.                 }
  76.             }
  77.             else
  78.             {
  79.                 Console.WriteLine("Liczba jest nieparzysta.");
  80.                 if (liczba > 5)
  81.                 {
  82.                     Console.WriteLine("Liczba {0} jest większa od 5", liczba);
  83.                 }
  84.                 else if (liczba == 5)
  85.                 {
  86.                     Console.WriteLine("Liczba {0} jest równa 5", liczba);
  87.                 }
  88.                 else
  89.                 {
  90.                     Console.WriteLine("Liczba {0} jest mniejsza od 5 ", liczba);
  91.                 }
  92.             }
  93.             */
  94.             /*
  95.             Console.WriteLine("Program rozwiązuje równanie kwadratowe.");
  96.             double a, b, c;
  97.             Console.WriteLine("Podaj a: ");
  98.             a = double.Parse(Console.ReadLine());
  99.             Console.WriteLine("Podaj b: ");
  100.             b = double.Parse(Console.ReadLine());
  101.             Console.WriteLine("Podaj c: ");
  102.             c = double.Parse(Console.ReadLine());
  103.  
  104.             double delta = (Math.Pow(b, 2)) - 4 * a * c;
  105.             Console.WriteLine("Delta wynosi: " + delta);
  106.            
  107.             if (delta > 0)
  108.             {
  109.                 double x1, x2;
  110.                 x1 = (-b - Math.Sqrt(delta)) / 2 * a;
  111.                 x2 = (-b + Math.Sqrt(delta)) / 2 * a;
  112.                 Console.Write("x1 = " + x1);
  113.                 Console.Write("x2 = " + x2);
  114.             }
  115.             else if (delta < 0)
  116.             {
  117.                 Console.WriteLine("brak rozwiązań");
  118.             }
  119.             else
  120.             {
  121.                 double x0;
  122.                 x0 = -b / 2 * a;
  123.                 Console.WriteLine("x0 = " + x0);
  124.             }
  125.             */
  126.             Console.ReadLine();
  127.         }
  128.     }
  129. }
  130.  
  131.  
  132.  
  133.  
  134.