Created
June 5, 2019 02:40
-
-
Save kei9327/b692b455473dc4ecd5cb38154631145a to your computer and use it in GitHub Desktop.
HackerRank>Algorithms>Warmup>Staircase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
#include <stdio.h> | |
using namespace std; | |
// Complete the staircase function below. | |
void staircase(int n) { | |
for (int i=0; i < n; i++) { | |
for (int j=0; j < n-i-1; j++) printf(" "); | |
for (int k=0; k < i+1; k++) printf("#"); | |
printf("\n"); | |
} | |
} | |
int main() | |
{ | |
int n; | |
cin >> n; | |
cin.ignore(numeric_limits<streamsize>::max(), '\n'); | |
staircase(n); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment