Advertisement
madras

Untitled

Jan 14th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.36 KB | None | 0 0
  1. // ZADANIE 1.
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace ConsoleApp23
  10. {
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             Console.Write("Podaj dlugosc pomieszczenia: ");
  16.             int a = int.Parse(Console.ReadLine());
  17.             Console.Write("Podaj szerokosc pomieszczenia: ");
  18.             int b = int.Parse(Console.ReadLine());
  19.  
  20.             if (a < 2 || b < 3 || a > 25 || b > 40)
  21.             {
  22.                 Console.Write("Zla dlugosc i szerokosc!\n");
  23.                 return;
  24.             }
  25.  
  26.             Console.Write("*");
  27.             for(int j = 0; j < b - 2; ++j)
  28.                 Console.Write("-");
  29.             Console.Write("*\n");
  30.            
  31.             for(int i = 0; i < a - 2; ++i)
  32.             {
  33.                 Console.Write("|");
  34.                 for (int j = 0; j < b - 2; ++j)
  35.                     Console.Write(".");
  36.                 Console.Write("|\n");
  37.             }
  38.  
  39.             Console.Write("*");
  40.             for (int j = 0; j < b - 2; ++j)
  41.                 Console.Write("-");
  42.             Console.Write("*\n");
  43.  
  44.  
  45.             Console.WriteLine("Dlugosc: {0} m", a);
  46.             Console.WriteLine("Szerokosc: {0} m", b);
  47.             Console.WriteLine("Pole: {0} m2", a*b);
  48.         }      
  49.     }
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement