HTML & JS
// C program to demonstrate the problem when
// scanf() is used in a loop
#include<stdio.h>

int main()
{
	char c;
	printf("......Enter q to quit......\n");
	do
	{
		printf("Enter a character\n");
		scanf("%c\n", &c);
		printf("%c\n", c);
	}
	while (c != 'q');
	return 0;
}

Generated URL:

Output:

......Enter q to quit......
Enter a character
a
Enter a character
b
Enter a character
q
Report Bug