Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Numbers_Pyramid
- {
- class Numbers_Pyramid
- {
- static void Main(string[] args)
- {
- uint n;
- string str = Console.ReadLine();
- bool a = UInt32.TryParse(str, out n);
- int count = 0;
- for (int i = 1; i <= n; i++)
- {
- count++;
- if ((count <= n) && a)
- {
- Console.Write(count + " ");
- for (int j = 2; j <= i; j++)
- {
- count++;
- if ((count <= n) && a) Console.Write(count + " ");
- else
- {
- Console.WriteLine();
- return;
- }
- }
- Console.WriteLine();
- }
- else
- {
- Console.WriteLine();
- return;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement