Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. Console.WriteLine("Przykladowy tekst");
  2. Console.Write("Przykladowy tekst");
  3. // Wielkość liter ma znaczenie, tekst może zawierać polskie znaki diakrytyczne
  4.  
  5. //Zad 7
  6. Console.WriteLine("Testowe");
  7. Console.Write("dsadas");
  8. Console.WriteLine("ąęąććźęęęa");
  9. Console.Write("Duże ZnaakII");
  10. //WriteLine zaczyna kolejną komende od nowej linijki
  11.  
  12. //Zad 8
  13. Int32 a, b;
  14. a = 130;
  15. b = 15;
  16. Console.WriteLine("Wartość a i b wynosi odpowiednio: " + a + " oraz " + b + " i są to liczby całkowite.");
  17.  
  18. //Nazwy zmiennych to a i b, są typu Int, można je wyświetlać w jednej komendzie poprzez +
  19. Int32 c = 10;
  20. Console.WriteLine("Przypisanie wartości przy deklaracji zmiennej: " + c);
  21.  
  22. //Zad 9
  23. c = Convert.ToDouble(Console.ReadLine());
  24. Console.WriteLine("Typ zmiennej double: ", c);
  25. Console.ReadKey(true);
  26.  
  27.  
  28.  
  29. namespace ConsoleApplication3
  30. {
  31. //Zad3_2
  32. class Program
  33. {
  34. static void Main(string[] args)
  35. {
  36. Int32 a;
  37. Console.WriteLine("Podaj liczbę");
  38. a = Int32.Parse(Console.ReadLine());
  39. switch (a)
  40. {
  41. case 0:
  42. {
  43. Console.WriteLine("Zero");
  44. }
  45. break;
  46. case 1:
  47. {
  48. Console.WriteLine("Jeden");
  49. }
  50. break;
  51. case 2:
  52. {
  53. Console.WriteLine("Dwa");
  54. }
  55. break;
  56. default:
  57. {
  58. Console.WriteLine("Nie wiem");
  59. }
  60. break;
  61.  
  62. }
  63. Console.ReadKey();
  64.  
  65. }
  66. }
  67. }
  68.  
  69. //Zad3_2
  70. class Program
  71. {
  72. static void Main(string[] args)
  73. {
  74. double a, b, c, pierwiastek, x0, x1, x2;
  75. double delta;
  76. Console.WriteLine("Podaj pierwszą liczbę: ");
  77. a = Convert.ToInt32(Console.ReadLine());
  78. Console.WriteLine("Podaj drugą liczbę: ");
  79. b = Convert.ToInt32(Console.ReadLine());
  80. Console.WriteLine("Podaj trzecią liczbę: ");
  81. c = Convert.ToInt32(Console.ReadLine());
  82.  
  83. delta = (b * b) - 4 * a * c;
  84. pierwiastek = (int)Math.Sqrt(delta);
  85.  
  86.  
  87. if (delta > 0)
  88. {
  89. x1 = (-b - pierwiastek)/2*a;
  90. x2 = (-b + pierwiastek)/2*a;
  91. Console.WriteLine("Delta wynosi:{0} ", delta);
  92. Console.WriteLine("Wynik równania kwadratowego wynosi: {0} i {1}", x1, x2);
  93. }
  94. else if (delta == 0)
  95. {
  96. x0 = -b/2*a;
  97. Console.WriteLine("Delta wynosi: {0} ", delta);
  98. Console.WriteLine("Wynik równania kwadratowego wynosi: ", x0);
  99. }
  100. else if (delta < 0)
  101. {
  102. Console.WriteLine("Delta jest równa 0");
  103.  
  104. }
  105.  
  106.  
  107. Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement