what is the Do-while loop?
it is also called an exit controller loop because, in the case of the do-while loop it case the initial condition is true or not at lase and as long as the test condition is true, the statement will be repeated again and again, otherwise the loop will terminate.
syntax
do{
statement(s);
}while(condition);
Structure
program
QUESTION:- print even number as the user input. per
#include <stdio.h>
#include <conio.h>
void main()
{
int no, even, i = 0;
printf("enter a value: ");
scanf("%d", &no);
printf("the even numbers
are: \n");
do
{
i = i + 2;
printf("%d ", i);
} while (i <= no);
getch();
}
OUTPUT
enter a value:
10
the even numbers are:
2 4 6 8 10 12
0 Comments