hello_loop.c

Code:

#include <stdio.h>

#include <cs50.h> // this library contains GetInt()

int main(void) {

printf("How many times should I say Hello?: ");

int num_hellos = GetInt();

// Note the use of the variable num_hellos in the for statement.

for (int i = 0; i < num_hellos; i++) {

printf("Hello\n");

}

}

Terminal window:

davidrhmiller@ide50:~/workspace/meeting_3_prework $ make hello_loop

clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wshadow hello_loop.c -lcs50 -lm -o hello_loop

davidrhmiller@ide50:~/workspace/meeting_3_prework $ ./hello_loop

How many times should I say Hello?: 7

Hello

Hello

Hello

Hello

Hello

Hello

Hello