Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ZADANIE 1.
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp23
- {
- class Program
- {
- static void RysujPomieszczenie(int b, int a)
- {
- Console.Write("*");
- for (int j = 0; j < b; ++j)
- Console.Write("-");
- Console.Write("*\n");
- for (int i = 0; i < a; ++i)
- {
- Console.Write("|");
- for (int j = 0; j < b; ++j)
- Console.Write(".");
- Console.Write("|\n");
- }
- Console.Write("*");
- for (int j = 0; j < b; ++j)
- Console.Write("-");
- Console.Write("*\n");
- Console.WriteLine("Dlugosc: {0} m", a);
- Console.WriteLine("Szerokosc: {0} m", b);
- Console.WriteLine("Pole: {0} m2", a * b);
- }
- static void Main(string[] args)
- {
- Console.Write("Podaj ilosc pomieszczen: ");
- int n = int.Parse(Console.ReadLine());
- int[] ta = new int[n];
- int[] tb = new int[n];
- for (int i = 0; i < n; ++i)
- {
- Console.Write("Podaj dlugosc pomieszczenia {0}: ", i + 1);
- ta[i] = int.Parse(Console.ReadLine());
- Console.Write("Podaj szerokosc pomieszczenia {0}: ", i + 1);
- tb[i] = int.Parse(Console.ReadLine());
- if (ta[i] < 2 || tb[i] < 3 || ta[i] > 25 || tb[i] > 40)
- {
- Console.Write("Zla dlugosc i szerokosc!\n");
- return;
- }
- }
- for (int i = 0; i < n; ++i)
- {
- RysujPomieszczenie(tb[i], ta[i]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement