Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp25
- {
- internal class Program
- {
- private static void Main(string[] args)
- {
- #region #1
- double a;
- double b;
- string c;
- Console.Write("Podaj a: ");
- a = Convert.ToDouble(Console.ReadLine());
- Console.Write("Podaj b: ");
- b = Convert.ToDouble(Console.ReadLine());
- Console.WriteLine("Wybierz operacje:\n'*' - mnożenie \t '/' - dzielenie\n'+' - dodawanie \t '-' - odejmowanie\n'^' - potęgowanie \t '%' - reszta z dzielenia");
- c = Console.ReadLine();
- switch (c)
- {
- case "*":
- Console.WriteLine(a * b);
- break;
- case "/":
- Console.WriteLine(a / b);
- break;
- case "+":
- Console.WriteLine(a + b);
- break;
- case "-":
- Console.WriteLine(a - b);
- break;
- case "^":
- Console.WriteLine(Math.Pow(a, b));
- break;
- case "%":
- Console.WriteLine(a % b);
- break;
- default:
- Console.WriteLine("Nie ma takiej operacji");
- break;
- }
- Console.ReadKey();
- #endregion
- #region #2
- Console.WriteLine("Wprowadź liczbę wierszy");
- int n = int.Parse(Console.ReadLine());
- for (int i = 1; i <= n; i++)
- {
- for (int j = 1; j <= i; j++)
- {
- Console.Write('*');
- }
- Console.WriteLine();
- }
- Console.ReadLine();
- #endregion
- #region #3
- Console.WriteLine("Wprowadź liczbę wierszy");
- int y = int.Parse(Console.ReadLine());
- for (int i0 = 1; i0 <= y; i0++)
- {
- for (int k = 1; k <= y; k++)
- {
- if (k >= 2 & k <= y - 1 & i0 >= 2 & i0 <= y - 1)
- {
- Console.Write(" ");
- }
- else
- {
- Console.Write("*");
- }
- }
- Console.WriteLine();
- }
- Console.ReadLine();
- #endregion
- }
- }
- }
Add Comment
Please, Sign In to add comment