Skip to content

Commit

Permalink
Problem solving
Browse files Browse the repository at this point in the history
  • Loading branch information
rmres committed Oct 12, 2020
1 parent c8bb54e commit 7b9fb9d
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions staircase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;

class Solution {

// Complete the staircase function below.
static void staircase(int n) {
for (int i = 0; i < n; i++) {
int a = n - (n-1);
a+=i;
string b = "";

if (i != n-1) {
b = new string(' ', n-i-1);
}

string c = new string('#', a);

Console.WriteLine(b + c);
}
}

static void Main(string[] args) {
int n = Convert.ToInt32(Console.ReadLine());

staircase(n);
}
}

0 comments on commit 7b9fb9d

Please sign in to comment.