Advertisement
IvetValcheva

demo

Mar 16th, 2024
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.37 KB | None | 0 0
  1.  
  2. int n = int.Parse(Console.ReadLine()); // n = 3
  3. int num = int.Parse(Console.ReadLine());
  4.  
  5. int count = 0;
  6. bool isFinish = false;
  7.  
  8. for (int row = 1;  row <= n; row++)
  9. {
  10.     for (int col = 1; col <= n; col++)
  11.     {
  12.         Console.Write("* ");
  13.         count++;
  14.  
  15.         if (count == num)
  16.         {
  17.             isFinish = true;
  18.             break;
  19.         }
  20.     }
  21.     Console.WriteLine();
  22.  
  23.     if (isFinish)
  24.         break;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement