desislava_topuzakova

Untitled

Jun 6th, 2020
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. using System;
  2.  
  3. namespace NumberPyramid
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int n = int.Parse(Console.ReadLine());
  10. int counter = 0;
  11.  
  12. for (int i = 1; i <= n; i++)
  13. {
  14. for (int j = 1; j <= i; j++)
  15. {
  16. counter++;
  17. Console.Write(counter + " ");
  18. if (counter == n) return;
  19. }
  20. Console.WriteLine();
  21. }
  22. }
  23. }
  24. }
Add Comment
Please, Sign In to add comment