MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / staircase

Function staircase

Hackerrank_problems/staircase/solution.cpp:7–25  ·  view source on GitHub ↗

Complete the staircase function below.

Source from the content-addressed store, hash-verified

5
6// Complete the staircase function below.
7void staircase(int n) {
8//first loop is used to make rows
9 for (int i = 0 ; i <n ; i++) {
10//second loop is used to make columns
11 for (int j=n-1 ; j>=0; j--){
12
13 if (j==i){
14 cout << ("#");
15 }
16 else if(j<i){
17 cout << ("#");
18 }
19 else {
20 cout<<(" ");
21 }
22 }
23 cout <<('\n');
24 }
25}
26
27int main()
28{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected