Sort by

recency

|

5193 Discussions

|

  • + 0 comments

    For Python3 Platform

    I wrote the code from scratch just to get more practice

    def staircase(n):
        for i in range(1,n+1):
            print(" "*(n-i) + "#"*i)
    
    n = int(input())
    
    staircase(n)
    
  • + 0 comments

    c++ solution:

    void staircase(int n){
       for ( int i = 1;i<=n;i++){
    	cout<< string(n-i, ' ');
    	cout<< string(i, '#')<< endl;
       }
    }
    
  • + 0 comments

    Python:

    def staircase(n): # Write your code here for i in range(1,n+1): text = '#'*i print(text.rjust(n))

  • + 0 comments

    a staircase is never just steps, it’s like frozen time between floors. u think u just climb, but really u pause between where u were and where u wanna be.

  • + 0 comments

    for (let i = 1; i <= n; i++) { let spaces = ' '.repeat(n - i); let hashes = '#'.repeat(i);
    console.log(spaces + hashes); }