Simple Loops in C

Description:

Create a program that asks the user to enter a number from 1 to 9

Print the statement “FAAU Owls – Hoot Hoot” the number of times entered by the user using a while  loop.

Print the statement “Programming is fun” the same number of times using a for loop.

Print the statement “Florida beaches are beautiful” the same number of times using a do/while loop. 

Solution 

lab3.c 

#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>

#include<stdlib.h>

int main()

{

intnum;

printf(“Please enter a number from 1 to 9= “);

scanf(“%d”, &num);

int counter = 1;

while (counter <= num) {

printf(“FAAU Owls – Hoot Hoot \n”);

counter++;

}

for (counter = 1; counter<= num; counter++) {

printf(“Programming is fun \n”);

}

counter = 1;

do {

printf(“Florida beaches are beautiful \n”);

counter ++;

} while (counter <= num);

return 0;

}