GerganaTsirkova

Asterix Rectangle

Sep 10th, 2017
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace SquareOfStars
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.  
  13.             int num;
  14.             string a = Console.ReadLine();
  15.             bool choice = int.TryParse(a, out num);
  16.             int i;
  17.             int k;
  18.             if ((choice == true) && ((((num > 2) || (num==2)))&&((num < 100)||(num==100))))
  19.             {
  20.                
  21.                 for (i = 0; i < num; i++)
  22.                 {
  23.                     for (k = 0; k < num - 1; k++)
  24.                     {
  25.                         if (i > 0 && k>0)
  26.                         {
  27.                             if ((i<num-1)&&(k<num-1))
  28.                             {
  29.                                 Console.Write(" ");
  30.                             }
  31.                             else
  32.                             {
  33.                                 Console.Write("*");
  34.                             }
  35.                         }
  36.                         else
  37.                         {
  38.                             Console.Write("*");
  39.                         }
  40.                        
  41.                        
  42.                     }
  43.                     Console.WriteLine("*");
  44.                 }
  45.  
  46.             }
  47.  
  48.         }
  49.  
  50.  
  51.  
  52.  
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment