   is it fine if we now the problem in this program
  Hi my friends...A few days ago a have tried to write a program by using for loop and I have found a strage thing in that program here is the program:#include<stdio.h>int main(){char response;int count;for(count=0;response !='N';count++){printf("hello\n");printf("Do you want to continue (Y/N):\n");scanf("%c",&response);} in the runtyped:hello "and asked me if I want continue(Y\N)?"Do you want to continue (Y/N): "and when I typed Y the result was:"hello Do you want to continue (Y/N):helloDo you want to continue (Y/N):    "and here forced me to enter either Y or N"so that Why did it type :hello Do you want to continue (Y/N):helloDo you want to continue (Y/N): twice without asking me if I want complete or not??????????????????   
  Why, are you using a for loop in this situation? It seems like a really bad thing to do in this case, most Y/N statements I use a while-loop or a do-while.   ;  Because scanf("%c") tells the computer that you want to read in a character. If you'd typed in two characters, it would have saved the second one for the next time around. So if you'd typed in "YYYYYYN", for instance, it would continue several times one after the other, each time displaying the question, and then stop.And in this case, you DID type in two characters. The 'Y', and the Enter key. That's the key which was used the second time around.   ;  One thing to note: it is possible for the program to quit immediately without showing the 'hello' string if response (incidentally) equals to 'N' because it is not initialized.This approach is generally preferable:int main (){    unsigned int uiKey = 0 ;    while ((uiKey = getch ()) != 'N')    {   //Do something...    }}You can also get rid of uiKey if it makes no use in the inner loop.   