while true c code example
Example 1: c do while
do {
} while();
Example 2: WHILE loop in c
while( a < 20 ) {
printf("value of a: %d\n", a);
a++;
}
Example 3: while loop in c
#include <stdio.h>
int main(){
int a, b;
printf("Enter Values a and b:\n");
scanf("%d %d", &a, &b);
while (a < b){
printf("%d is greater than %d\n", b, a);
printf("Enter Values a and b:\n");
scanf("%d %d", &a, &b);
}
printf("%d is greater than %d\n", a, b);
}
Example 4: do while loop in c
#include <stdio.h>
main()
{
int a;
do
{
printf("\nEnter your value: ");
scanf("%d", &a);
} while (a<10);
printf("Value greater than 10");
}
Example 5: how to do a while true in C
for(;;) {
...
}