Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. var n = int.Parse(Console.ReadLine());
  4. int sum = 1;
  5. for (int row = 1; row <= n; row++) {
  6. for (int col = 1; col <= row; col++) {
  7. Console.Write(sum+ " ");
  8. sum++;
  9. if(sum > n) {
  10. return;
  11. }
  12. }
  13. Console.WriteLine();
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement