Hackerrank Solution StairCase in C language | Algorithms - Online Judge Solution

Latest

It is a free Online judges problems solution list. Here you can find UVA online Judge Solution, URI Online Judge Solution, Code Marshal Online Judge Solution, Spoz Online Judge Problems Solution

Saturday, May 6, 2017

Hackerrank Solution StairCase in C language | Algorithms

Hackerrank Solution StairCase in C language | Algorithms



HackerRank Online Judge Solution StairCase | Algorithms
HackerRank Main Problem Link - https://www.hackerrank.com/challenges/staircase

Problem Name: HackerRank Problem StairCase
Problem Number : HackerRank Problem StairCase Solution


Online Judge : HackerRank Online Judge Solution
Category: Algorithm
Solution Language : C, C plus plus

Hackerrank Solution StairCase in C language | Algorithms

HackerRank Solution StairCase Code in C,CPP:


#include<stdio.h>
int main()
{
    int n, space = 0, hash = 0, i, j;

    scanf("%d", &n);

    for(i = 0; i < n; i++)
    {
        space = n - (i+1);
        for(j = 0; j < space; j++)
        {
            printf(" ");
        }

        hash = i + 1;
        for(j = 0; j < hash; j++)
        {
            printf("#");
        }

        printf("\n");
    }
}

No comments:

Post a Comment