Respuesta :
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.
Answer:
#include <stdio.h>
void main()
{
int i = 0;
do{
printf("%d ", ++i);
}
while (i < 5);
i=i+1;
}
}
Explanation
The #include needs to include something and that's the standard input and output which is coded has stdio.h
In the do while loop what it does is print the value of I while I is less than 5 and you increment I value so as to prevent infinite looping