Sunday, 2 April 2017

Hacker Rank solution for Staircase in C++

Problem:- staircase solution in C++ or staircase hacker rank solution in Java or staircase hacker rank solution c++ or staircase hacker rank solution c++ or staircase program in c or staircase solution in c or staircase hacker rank solution in python or staircase in java or staircase hacker rank solution in c or Hacker Rank Solution For staircase in C++ or staircase in C++ or Hacker Rank solution for staircase in C++.


Logic:- staircase hacker rank solution there is no logic we have to just print the pattern in a staircase by using the hash (#) symbol. we always use stairs in our daily life now turn to implement in programming life. See the below pattern this is called a staircase.When asking for the user to enter the number that means the height of staircase. In this case, I am taking Height = 10.

Staircase Pattern

                  #
                ##
              ###
            ####
          #####
        ######
      #######
    ########
  #########
##########

Check- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard Domain.


Submit your solution here:- Click here

Tip:- Before copy the solution I recommended please read this full article, this will help you to build your own logic. 

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++


Hacker Rank solution for Staircase in C++


You May Like This:-

1. Hacker Rank Solution for 30 Days of Code

2. Hacker Rank solution for Attribute Parser

3. Java Program For Find The Gross Salary Of An Employee

4. Hacker Rank Solution For Conditional Statements

5. Hacker Rank Solution For Mini-Max Sum

6. Hacker Rank Solution For Birthday Cake Candles

7. Geeksforgeeks Solution For " Sum of Middle Elements of two sorted arrays "

8. Java Program For Converting Temperature Celsius Into Fahrenheit

9. Geeksforgeeks Solution For " Two Repeated Elements "

10. Hacker Rank Solution For Virtual Functions


Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment