Answers for "while loop in c"

C
13

c do while

do {
    // code
} while(/* condition */);
Posted by: Guest on January-23-2021
0

while loop in c

//While loop, for the largest of two numbers.
#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);
      
}
Posted by: Guest on April-19-2021
1

WHILE loop in c

while( a < 20 ) {
      printf("value of a: %d\n", a);
      a++;
   }
Posted by: Guest on July-08-2020
0

do while loop in c

//This program stops when a number greater than 10 is printed and prints that, value greater than 10
#include <stdio.h>
main()
{

    int a;
    do
    {
        printf("\nEnter your value: ");
        scanf("%d", &a);
    } while (a<10);
    printf("Value greater than 10");
    
    
}
Posted by: Guest on April-19-2021
0

correct while loop syntax in c

while(condition) {
   statement(s);
}
Posted by: Guest on August-02-2021
-1

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;
}
Posted by: Guest on December-08-2020

Code answers related to "C"

Browse Popular Code Answers by Language