syntax of do while loop code example
Example 1: do whie loop
do{
----
} while(condition);
Example 2: do-while in c
#include <stdio.h>
int main()
{
int j=0;
do
{
printf("Value of variable j is: %d\n", j);
j++;
}while (j<=3);
return 0;
}
Example 3: c make loop
#include <stdio.h>
int main()
{
int i = 1;
while (i <= 5)
{
printf("%d\n", i);
++i;
}
return 0;
}
Example 4: while loop
#include<stdio.h>
int main()
{
printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");
int i = 0;
printf("\nPrinting numbers using while loop from 0 to 9\n\n");
while(i<10)
{
printf("%d\n",i);
i++;
}
printf("\n\n\t\t\tCoding is Fun !\n\n\n");
return 0;
}