Sunday, 2 April 2017

Hacker Rank Solution For " Staircase " in C++

Problem :- Staircase

Submit Your Solution Here :- Click Here

Copy The Color Code and paste it into hackerrank Editor .

Solution :-

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int n,i,j,k;
    cin >> n;
    for(i=n;i>=1;i--){
        for(j=1;j<i;j++){
            cout<<" ";
        }
        for(k=n;k>=i;k--){
            cout<<"#";
        }
        cout<<endl;
    }    
    return 0;
}



Output :-

Hacker Rank Solution For " Staircase " in C++

No comments:
Write comments

Recommended Posts × +