Competitive Programming Solutions

GitHub
back to dashboard

O. Pyramid

Codeforces - Sheet #2 (Loops) · limit: 1s · memory: 256MB · view on codeforces

input

4

output

*
**
***
****
Main.java
static void solve() {

        // Write your solution here
        int n = in.nextInt();
        int i = 1;
        while (i <= n) {
            int j = 1;
            while (j++ <= i)
                out.print("*");
            out.println();
            i++;
        }

    }