Advertisement
Guest User

SU PB 07.01.2018 Exam: 05 VK

a guest
Mar 1st, 2018
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.17 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             int number = int.Parse(Console.ReadLine());
  15.             int width = (4 * number) - 4;
  16.             int spacesTimes = width - 4;
  17.             int kriloTimes = 1;
  18.  
  19.  
  20.             // cycle 1
  21.  
  22.             for (int c1 = 1; c1 <= number - 2; c1++)
  23.             {
  24.  
  25.  
  26.                 string spaces = new string(' ', spacesTimes);
  27.                 string kriloRight = string.Join("", Enumerable.Repeat("/*", kriloTimes));
  28.  
  29.                 string kriloLeft = string.Join("", Enumerable.Repeat("*\\", kriloTimes));
  30.                 string total = kriloLeft + spaces + kriloRight;
  31.                 kriloTimes++;
  32.                 spacesTimes-=4;
  33.                 Console.WriteLine(total);
  34.                
  35.             }
  36.  
  37.             string middleUp = string.Join("", Enumerable.Repeat("\\/", (width / 2)));
  38.             string middleDown = string.Join("", Enumerable.Repeat("/\\", (width / 2)));
  39.             Console.WriteLine(middleUp);
  40.  
  41.             //cycle 2
  42.  
  43.             for (int c2 = 1; c2 <= number / 2; c2++)
  44.             {
  45.                 string arrowLeft = new string('<', (width - 6) / 2);
  46.                 string arrowRight = new string('>', (width - 6) / 2);
  47.  
  48.                 string total = arrowLeft + "*|**|*" + arrowRight;
  49.                 Console.WriteLine(total);
  50.             }
  51.             Console.WriteLine(middleDown);
  52.  
  53.             //cycle 3
  54.             spacesTimes+=4;
  55.             kriloTimes = (width - spacesTimes)/4;
  56.  
  57.             for (int c3 = 1; c3 <= number-2; c3++)
  58.             {
  59.                 string spaces = new string(' ', spacesTimes);
  60.                 string kriloRight = string.Join("", Enumerable.Repeat("\\*", kriloTimes));
  61.  
  62.                 string kriloLeft = string.Join("", Enumerable.Repeat("*/", kriloTimes));
  63.                 string total = kriloLeft + spaces + kriloRight;
  64.                 kriloTimes--;
  65.                 spacesTimes += 4;
  66.                 Console.WriteLine(total);
  67.             }
  68.         }
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement