Hello maybe this is easy question but i couldn't why it happened.
Here is my code.
[CODE]#include <stdio.h>
#include <conio.h>
int main(){
char x;
do{
printf("?: ");
scanf("%c",&x);
if(x=='s')
printf("open\n");
else
printf("closed\n");
}
while(x!='s');
getch();
return 0;
}CODE]
I started exe and it gave this.
Code:
?: a
closed
?: closed/* makes this one for 2 times. it's not scaning in this part.*/
?: a
closed
?: closed
?: s
open
but i was excepting that it will give like this
Code:
?: a
closed
?:a
closed
?: a
closed
?:a
closed
?: s
open
it's very simple code. but i couldn't find why this happens. i'm waiting your reply a.s.a.p thx