J
j.smith2c
Hi everyone,
I wanted to run the following loop,
and enter y everytime (I expected that it will ask
me to enter y for 5 time), but just after 3 times program terminates.
what is the error??
#include <stdio.h>
int main ()
{
char ch;
int j=0;
for (j ; j<5 ; j++)
{
printf("Please enter the input character :\n\n");
scanf("%c", &ch);
printf("You have entered : %c \n\n" , ch);
if (ch == 'y' || ch == 'Y')
printf("HIIIIIIIII \n");
}
return 0;
}
I wanted to run the following loop,
and enter y everytime (I expected that it will ask
me to enter y for 5 time), but just after 3 times program terminates.
what is the error??
#include <stdio.h>
int main ()
{
char ch;
int j=0;
for (j ; j<5 ; j++)
{
printf("Please enter the input character :\n\n");
scanf("%c", &ch);
printf("You have entered : %c \n\n" , ch);
if (ch == 'y' || ch == 'Y')
printf("HIIIIIIIII \n");
}
return 0;
}