1617719220

# Learning C: The Input and Process Until Done Template and the while Loop

In this article, I discuss the next major construct in C — the loop. I’ll start by introducing a new program template related to loops, the Input and Process Until Done template, and then I’ll demonstrate how to implement this template using one C looping construct — the `while` statement.

## The Input and Process Until Done Template

One of the most common things you do in a computer program is repeatedly as the user for data and process that data until there is no more data to input. The Input and Process Until Done template provides an outline for how to write the code for this task.

Here is the pseudocode for the template:

Repeat the following until finished:

Process the value

An example, which I’ll demonstrate in C down below, is to determine the average grade on a test by inputting all the test scores and then computing the average once the last test grade is entered. Here is some possible pseudocode for this problem:

While there are more grades to enter:

Prompt the user to enter a grade

Get the grade from the keyboard

Compute the average

Now let’s see how to implement this template using the while statement.

#c-programming-language #learn-to-code #c-programming #c #learn-to-program

1617719220

## Learning C: The Input and Process Until Done Template and the while Loop

In this article, I discuss the next major construct in C — the loop. I’ll start by introducing a new program template related to loops, the Input and Process Until Done template, and then I’ll demonstrate how to implement this template using one C looping construct — the `while` statement.

## The Input and Process Until Done Template

One of the most common things you do in a computer program is repeatedly as the user for data and process that data until there is no more data to input. The Input and Process Until Done template provides an outline for how to write the code for this task.

Here is the pseudocode for the template:

Repeat the following until finished:

Process the value

An example, which I’ll demonstrate in C down below, is to determine the average grade on a test by inputting all the test scores and then computing the average once the last test grade is entered. Here is some possible pseudocode for this problem:

While there are more grades to enter:

Prompt the user to enter a grade

Get the grade from the keyboard

Compute the average

Now let’s see how to implement this template using the while statement.

#c-programming-language #learn-to-code #c-programming #c #learn-to-program

1617981540

## Learning C: The Do-while Statement and The input and Process Until Done Template

In this article I’m going to demonstrate another way to implement the Input and Process Until Done  template using the `do-while`  statement. The major difference between the `while`  statement and the `do-while`  statement is that with the `do-while`  statement the condition is tested at the bottom of the loop instead of at the top as it is with the `while`  statement.

#programming-languages #learn-to-program #c-programming-language #learn-to-code #c-programming

1589796212

## C++ Tutorial - Loops In C++ [For Loop, While Loop, Do While Loop]

In this C++ Tutorials we are going to talk about Loops In C++, we are going to learn different C++ Loops like For Loop, While Loop and Do While Loop. There may be a situation, when you need to execute a block of code several number of times, using loops you can do these kind of functionalities. A loop statement allows us to execute a statement or group of statements multiple times. There are different types of loops that you can use in c++, for loop, while loop, do while loop, also there are different control statements like break and continue in c++ loops, using control statements we can change the execution of loops from its normal sequence.

#c #c# #c++ #programming-c

1590587580

## Loops in C++ | For, While, and Do While Loops in C++

In this Video We are going to see how to use Loops in C++. We will see How to use For, While, and Do While Loops in C++.
C++ is general purpose, compiled, object-oriented programming language and its concepts served as the basis for several other languages such as Java, Python, Ruby, Perl etc.

#c #c# #c++ #programming-c

1599201978

## For loop in C++ Program | C++ For Loop Example

For loop in C++ Program | C++ For Loop Example is today’s topic. For understanding for loop, we must have prior knowledge of loops in C++. Loops are used when we want a particular piece of code to run multiple times. We use loops to execute the statement of codes repeatedly until a specific condition is satisfied. It eases the work of the programmer and also shortens the code length.

### For loop in C++ Program

For example, if we want to print numbers from 1 to 1000, then if we don’t use loops, we have to write 1000 different print statements for printing numbers from 1 to 1000. With the help of loops, we can write this code in 2 lines. We need to run the loop and give iteration conditions.

There are 3 types of loops for loopwhile loop and do-while loop. In this tutorial, we will learn about for loop.

A for loop is the repetition control structure that is generally used to write a code more efficiently which is supposed to be executed a specific number of times.

#c++ #for loop #while loop #do-while loop