when you press enter after entering a character.
scanf reads the character first time from the input buffer and the
next time it reads only enter from input buffer.
Solution to the problem is using "fflush(stdin)" after scanf command.

On Oct 12, 2:25 am, carry <pawan1991ya...@gmail.com> wrote:
> int main()
> {
> int i;
> char c;
> for(i=0;i<5;i++)
> {
> scanf("%d",&c);
> printf("%d",c);}
> }
>
> why the program scans only one time if u give an alphabet as an
> input??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to