DO WHILE Loop in C Language:
(1) Unlike the for and while loops, the do-while is an exit-controlled loop i.e. it evaluates its test-expression at the bottom of the loop after executing its loop-body statements. This means that a do-while loop always executes at least once. In other two loops for and while, the test-expression is evaluated at the beginning of the loop i.e. before executing the loop-body. If the test-expression evaluates to false for the first time itself, the loop is never executed. But in some situations, it is wanted that the loop-body is executed at least once, no matter what the initial state of the test-expression is. In such cases, the do-while loop is the obvious choice.
(2) Sample C language code and its output, as shown:
//Table of 2 using for loop
i = 0;
x = 1;
i = i + 2;
printf(“2 * %d = %d \n”,x,i);
while (x <= 10);
(3) After that go to the “Build” menu and select the “Build” option for publishing the code as shown.
(4) After building the code, press the “Run” button, as shown.
(5) After pressing the “run” button, the output screen is opened, as shown.
DO WHILE Loop Syntax:
|FOR Loop in C Language|
WHILE Loop in C Language
do-while Statement (C)– Microsoft Docs
Use of CHAR function in SQL
Use of CONCAT Function in SQL