G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 3rd, 2020 138 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         string meta = Console.ReadLine();
  8.         string[] arr = meta.Split();
  9.         string letter = arr[0];
  10.         sbyte number = sbyte.Parse(arr[1]);
  11.        
  12.         if (number < 3 || number > 100) Console.WriteLine("zla wartosc");
  13.         else if (letter == "B")
  14.         {
  15.             GeneratePatternB(number);
  16.         }
  17.         else if (letter == "A")
  18.         {
  19.             sbyte secondParametr = sbyte.Parse(arr[2]);
  20.             GeneratePatternA(number, secondParametr);
  21.         }
  22.     }
  23.    
  24.     public static void GeneratePatternA(sbyte number, sbyte secondParametr)
  25.     {
  26.         int fristParam = number % 2 == 0 ? number + 1 : number;
  27.         int secondParam = secondParametr % 2 == 0 ? secondParametr + 1 : secondParametr;
  28.        
  29.         for (int i = 0; i < secondParam; i++)
  30.         {
  31.             for (int j = 0; j < fristParam; j++)
  32.             {
  33.                 if (i == 0 || i == fristParam || i % 3 == 0) Console.Write("*");
  34.                 else if (j == 0 || j % 4 == 0) Console.Write("*");
  35.                 else Console.Write(".");
  36.             }
  37.             Console.WriteLine();
  38.         }
  39.     }
  40.    
  41.     public static void GeneratePatternB(sbyte number)
  42.     {
  43.         for (int i = 1; i <= number; i++)
  44.         {
  45.             for (int j = 1; j <= number; j++)
  46.             {
  47.                 if (i == 1 || i == number) Console.Write("*");
  48.                 else if (i == j) Console.Write("*");
  49.                 else Console.Write(".");
  50.             }
  51.             Console.WriteLine();
  52.         }
  53.     }
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top