summaryrefslogtreecommitdiff
path: root/wk3/lect/iteration.c
blob: 32a8a9d18fc4627428043d3afe0deb0811b7a19e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <cs50.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void draw(int n);

int main(void) {
    int height = get_int("Height: ");
    draw(height);
}

void draw(int n) {
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < i + 1; j++) {
            printf("#");
        }
        printf("\n");
    }
}