Advertisement
madras

Untitled

Jan 14th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 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 RysujPomieszczenie(int b, int a)
  14. {
  15. Console.Write("*");
  16. for (int j = 0; j < b - 2; ++j)
  17. Console.Write("-");
  18. Console.Write("*\n");
  19.  
  20. for (int i = 0; i < a - 2; ++i)
  21. {
  22. Console.Write("|");
  23. for (int j = 0; j < b - 2; ++j)
  24. Console.Write(".");
  25. Console.Write("|\n");
  26. }
  27.  
  28. Console.Write("*");
  29. for (int j = 0; j < b - 2; ++j)
  30. Console.Write("-");
  31. Console.Write("*\n");
  32.  
  33.  
  34. Console.WriteLine("Dlugosc: {0} m", a);
  35. Console.WriteLine("Szerokosc: {0} m", b);
  36. Console.WriteLine("Pole: {0} m2", a * b);
  37. }
  38.  
  39. static void Main(string[] args)
  40. {
  41. Console.Write("Podaj dlugosc pomieszczenia: ");
  42. int a = int.Parse(Console.ReadLine());
  43. Console.Write("Podaj szerokosc pomieszczenia: ");
  44. int b = int.Parse(Console.ReadLine());
  45.  
  46. if (a < 2 || b < 3 || a > 25 || b > 40)
  47. {
  48. Console.Write("Zla dlugosc i szerokosc!\n");
  49. return;
  50. }
  51. RysujPomieszczenie(b, a);
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement