Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Console.WriteLine("Przykladowy tekst");
- Console.Write("Przykladowy tekst");
- // Wielkość liter ma znaczenie, tekst może zawierać polskie znaki diakrytyczne
- //Zad 7
- Console.WriteLine("Testowe");
- Console.Write("dsadas");
- Console.WriteLine("ąęąććźęęęa");
- Console.Write("Duże ZnaakII");
- //WriteLine zaczyna kolejną komende od nowej linijki
- //Zad 8
- Int32 a, b;
- a = 130;
- b = 15;
- Console.WriteLine("Wartość a i b wynosi odpowiednio: " + a + " oraz " + b + " i są to liczby całkowite.");
- //Nazwy zmiennych to a i b, są typu Int, można je wyświetlać w jednej komendzie poprzez +
- Int32 c = 10;
- Console.WriteLine("Przypisanie wartości przy deklaracji zmiennej: " + c);
- //Zad 9
- c = Convert.ToDouble(Console.ReadLine());
- Console.WriteLine("Typ zmiennej double: ", c);
- Console.ReadKey(true);
- namespace ConsoleApplication3
- {
- //Zad3_2
- class Program
- {
- static void Main(string[] args)
- {
- Int32 a;
- Console.WriteLine("Podaj liczbę");
- a = Int32.Parse(Console.ReadLine());
- switch (a)
- {
- case 0:
- {
- Console.WriteLine("Zero");
- }
- break;
- case 1:
- {
- Console.WriteLine("Jeden");
- }
- break;
- case 2:
- {
- Console.WriteLine("Dwa");
- }
- break;
- default:
- {
- Console.WriteLine("Nie wiem");
- }
- break;
- }
- Console.ReadKey();
- }
- }
- }
- //Zad3_2
- class Program
- {
- static void Main(string[] args)
- {
- double a, b, c, pierwiastek, x0, x1, x2;
- double delta;
- Console.WriteLine("Podaj pierwszą liczbę: ");
- a = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Podaj drugą liczbę: ");
- b = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Podaj trzecią liczbę: ");
- c = Convert.ToInt32(Console.ReadLine());
- delta = (b * b) - 4 * a * c;
- pierwiastek = (int)Math.Sqrt(delta);
- if (delta > 0)
- {
- x1 = (-b - pierwiastek)/2*a;
- x2 = (-b + pierwiastek)/2*a;
- Console.WriteLine("Delta wynosi:{0} ", delta);
- Console.WriteLine("Wynik równania kwadratowego wynosi: {0} i {1}", x1, x2);
- }
- else if (delta == 0)
- {
- x0 = -b/2*a;
- Console.WriteLine("Delta wynosi: {0} ", delta);
- Console.WriteLine("Wynik równania kwadratowego wynosi: ", x0);
- }
- else if (delta < 0)
- {
- Console.WriteLine("Delta jest równa 0");
- }
- Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement