Home computickets Block diagram of the loop. Theory

# Block diagram of the loop. Theory

Author

Date

Category

I pass testing at a distance in cycles, according to the condition of the problem, I have to write a utility having only the block diagram below in my hands:

The third and fifth blocks are called the upper and lower bounds of the condition. Also, the course provides a description of this block diagram. But she also confuses me:

But if this block diagram means an “if” condition, then “if” has its own notation, just like “while”, “do while” and others. I am failing all the questions that are related to this flowchart.
Akina, even if I implement the simplest Loop in C # like:

``````static int SumDoWhile ()
{
//
// Sum numbers 0 .. 4
//
int sum = 0;
int i = 0;
do
{
sum + = i;
i ++;
} while (i & lt; 5);
return sum;
}
``````

Then the block diagram for it will look like:

cassini, do I understand you correctly that the drawing of the very first flowchart can be described as follows:

``````public delegate void TopMessage (string message);
class Program
{
static void Main (string [] args)
{
int a = 0;
int b = 1;
do
{
b = b + a;
a ++;
}
while (a & lt; 5);
Console.WriteLine (a);
}
``````

and will it be correct?

These are really quite ordinary loops with a precondition (while) or postcondition (do .. while). Perhaps the reason to contact the authors of the course.

Multiple sources:

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.