Sort by

recency

|

5157 Discussions

|

  • + 0 comments

    TypeScript

    function staircase(n: number): void {
        for (let i = 1; i <= n; i++) {
            const spaces = ' '.repeat(n - i);
            const hashes = '#'.repeat(i);
            console.log(spaces + hashes);
        }
    }
    const n = parseInt(require('fs').readFileSync(0, 'utf-8').trim());
    staircase(n);
    
  • + 0 comments
    int i, j;
    for (i = 0; i < n; i++) {
        for (j = i; j < n - 1; j++) {
            printf(" ");
        }
        for (j = 0; j <= i; j++) {
            printf("#");
        }
        printf("\n");
    }
    

    }

  • + 0 comments

    A clean and safe staircase really makes a difference in any home. Dust, dirt, and debris can build up quickly on steps, especially in high-traffic areas. That’s why regular attention from home cleaning services is so important. Not only does it keep the staircase looking fresh, but it also helps prevent slips and falls. Whether it’s wiping down railings or making sure no grime gets left in the corners, a detailed clean goes a long way. Home cleaning services can tackle those hard-to-reach spots that are easy to overlook. A sparkling staircase gives the whole house a polished look. It’s one of those little things that makes a big impact.

  • + 0 comments
    function staircase(n) {
        // Write your code here
        let spaces, hashes 
        for (let i = 1; i <= n; i++) {
           let spaces = " ".repeat(n - i);
           let hashes = "#".repeat(i);
            console.log(spaces+hashes)
        }
    
    }
    
  • + 0 comments

    for row in range(n): string = "" for col in range(n): if col <= row: string += "#" else: string = " " + string print(string)