We appreciate your visit to Implement the program for this problem using a while loop construct and follow the code guidelines as described Task Write a program that will count. This page offers clear insights and highlights the essential aspects of the topic. Our goal is to provide a helpful and engaging learning experience. Explore the content and find the answers you need!

Implement the program for this problem using a while loop construct, and follow the code guidelines as described:

**Task**: Write a program that will count down from 20 to 5 inclusive and display the count on the Console by performing the following steps:

1. Declare a variable of `int` data type with a name of your choice.
2. Assign the appropriate initial value to the variable that you declared.
3. Use a while loop construct that will loop based on the appropriate test condition involving the variable that you declared.
4. The body of the while loop should contain program statements that will perform the following:
- Display the text "variable name" followed by the value of the variable on the Console display.
- Create a Delay of 800 milliseconds using the KISS statement `msleep(800);`.
- Modify your variable as appropriate for counting down.
- Display the text "Count is smaller than 10" when the count is less than 10; otherwise, display the text "Count is large."
- Additionally, display the text "Count is now 16" when the count is exactly 16.

5. After the while loop is exited, display "Excellent" on the next line of the Console display.

**C Language Example Code**:
```c
#include

int main()
{
int counter;
counter = 20;

while (counter >= 5)
{
printf("counter is %d\n", counter);

if (counter < 10)
{
printf("Count is smaller than 10\n");
}
else
{
printf("Count is large\n");
}

if (counter == 16)
{
printf("Count is now 16\n");
}

counter = counter - 1;
msleep(800);
}

printf("Excellent\n");
return 0;
}
```

Ensure you include the necessary header file for `msleep()` if it's not a standard function in your environment.

Answer :

Final Answer:

The provided program counts down from 20 to 5 inclusive using a while loop in the C language. It displays the current count, adds an 800-millisecond delay after each iteration, and modifies the counter. If the count is less than 10, it prints "Count is smaller than 10"; if the count is exactly 16, it prints "Count is now 16". After the loop, it displays "Excellent".

Explanation:

The given C program utilizes a while loop to count down from 20 to 5 inclusively. The 'counter' variable is initialized to 20 and decremented by 1 in each iteration. The loop continues as long as the 'counter' is greater than or equal to 5. Inside the loop, the program prints the current count using the 'printf' function with the specified format. It also includes a delay of 800 milliseconds using the 'msleep' function.

In addition, the program features conditional statements to provide additional information based on the count value. If the count is less than 10, it prints "Count is smaller than 10". When the count is exactly 16, it prints "Count is now 16". This enhances the program's functionality by displaying relevant messages for specific count values.

After the loop completes, the program displays "Excellent" on the Console. This signifies the successful execution and completion of the countdown loop.

Learn more about C language

https://brainly.com/question/33806238

#SPJ11

Thanks for taking the time to read Implement the program for this problem using a while loop construct and follow the code guidelines as described Task Write a program that will count. We hope the insights shared have been valuable and enhanced your understanding of the topic. Don�t hesitate to browse our website for more informative and engaging content!

Rewritten by : Barada

Final answer:

This program in C uses a while loop to count down from 20 and display certain messages when the count is less than 10 or equals to 16. The 'msleep(800)' function isn't a standard C function and won't work as intended.

Explanation:

The subject of your question is about

C programming

, specifically using a

while loop

to count down from 20 and display certain messages at specified counts. According to your requirements, here's the modified code you can use:

int main() { int counter = 20; while (counter >=5) { printf("Counter is %d\n", counter); if (counter < 10) printf("Count is smaller than 10\n"); else printf("Count is large\n"); if (counter == 16) printf("Count is now 16\n"); counter = counter - 1; msleep(800); } printf("Excellent\n"); return 0; }

The

msleep(800)

function will have no effect here since it's not part of the standard C language. It's typically used in embedded system coding but won't work in a regular C program.

Learn more about While loop in C programming here:

https://brainly.com/question/34691029

#SPJ11