You are entering "a\ne\nr\nx\n" and the scanf() call fetches a, \n, e, \n, r, \n, x, and never gets a chance to fetch the last character, \n, because the loop exits.
program:
#include
int main()
{
char ch;
printf("Enter keys, x to stop\n");
do
{
printf(":");
scanf("%c",&ch);
}while(ch!='x');
printf("End");
return 0;
}
i think it will give the output like this
:a
: e
:r
: x
END
but it gives
output:
:a
:: e
::r
:: x
END
why is the : is printed twice
please explain