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:

 enter image description here

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:

 enter image description here

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.
Thanks for the answer, Lover.
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:

 enter image description here

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);
      Console.ReadLine ();
    }

and will it be correct?
enter image description here


Answer 1, authority 100%

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:

Programmers, Start Your Engines!

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.

Recent questions