EmbLogic's Blog

#include
int main()
{
int i,k;
for(k=1;k<=10;k++)
{
i=getchar();
putchaar(i);
return 0;
}

//my doubt is…Why loop is executing 5 times instead of 10…

2 Responses to

  1. zaffer says:

    the thing is that when u enter any character via terminal you press another character along with it .i.e ‘\n’..so at one time it takes two characters hence it works five times only.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>