Answer:
The program using do-while loop defined as follows:
Program:
#include <stdio.h> //include header file
int main() //defining main method
{
int i = 0; //defining integer variable i and assign value.
//defining do-while loop
do
{
printf("%d", ++i); //print value
}while (i<5); //check condition
return 0;
}
Output:
12345
Explanation:
Output of given program:
In the given program, it will not print any value because in while loop semi colon is used which is not valid.
Program Explanation:
In the above C language program header file is included, which provides features to use basic function then the main method is defined inside this method an integer variable "i" declare, that holds a value which is "0". In this method, the do-while loop is defined. In the do section, we print value and in the while block checks the condition which is i is less than 5.