Computer Science, asked by CARELESSGIRL, 1 year ago

What are the general description for loop statement and available loop types in C?

Answers

Answered by EHSASS
4

★彡 ʜᴇʀᴇ ɪs ʏᴏᴜʀ ᴀɴsᴡᴇʀ 彡★

A statement that allows executing statement or group of statements in repeated way is defined as a loop. Following diagram explains

Following diagram explains a general form of a loop.

There are 4 types of a loop statement in C.

▶️ While loop

▶️ For Loop

▶️ Do…While Loop

▶️ Nested Loop

ᴇʜsᴀss  ✿◕ ‿ ◕✿

Attachments:
Answered by ankhidassarma9
1

Answer:

Loop Statements in C execute the sequence of statements many times until the stated condition becomes false.

‘C’ programming language provides three types of loop constructs:

  • For Loop
  • While Loop
  • Do-while Loop :

Explanation:

  • The versatility of the computer lies in its ability to perform a set of instructions repeatedly that involves repeating some portion of the program either a specified number of times or a particular condition is being satisfied. This is done through a loop control structure.
  • The loop statements continue while a condition is true.
  • When the condition becomes false, the loop ends and the control      passes to the statements following the loop.
  • In C language, A loop consists of two parts, a body of a loop and a control statement. The control statement is a combination of some conditions which control  the execution of the body of the loop  until the specified condition becomes false.
  • Depending upon the position of a control statement in a program, Loop in C is classified into two types:

                  1. Entry controlled loop

                  2. Exit controlled loop

  • In an entry control loop , a condition is checked before execution of the body of a loop.
  • In an exit controlled loop, a condition is checked after the execution of the body of a loop.

‘C’ programming language provides three types of loop constructs:

  • For Loop : In a for loop, the initialization of loop counter  is performed only once, then the condition tests and compares the counter to a fixed value after each iteration and stopping the loop when condition is false .
  • While Loop : In while loop, a condition is evaluated before processing a body of the loop. If a condition is true then  only the body of a loop is executed.
  • Do-while Loop : In a do-while loop, the condition is always executed after the execution of the body of a loop. It is also called an exit-controlled loop.

Similar questions