Home » Uncategorized » Do while loop in C

Do while loop in C

#include <stdio.h>
int main (int argc, char **argv) {
	int a = 10;
	char another;

	/* Ideally this program works, but in Linux
	\n creates problem to accept the another 
	character using scanf. */
	do {
		printf("value of a: %d\n", a);
		a = a + 1;
		printf("do you want to continue Y/N ?");
		scanf("%c", &another);
	} while( another == 'Y');
	return 0;
C#-S-5: if-else condition
C#-S-5: if-else condition

Leave a Comment

Sign up to our newsletter!