int main ()
{
    char c;
    int choice,dummy;
    do{
    printf("1. Print Hello\n2. Print World\n3. Exit\n");
    scanf("%d",&choice);
    switch(choice)
    {
        case 1 :
        printf("Hello\n");
        break;
        case 2:
        printf("World\n");
        break;
        case 3:
        exit(0);
        break;
        default:
        printf("please enter valid choice\n5");
    }
    printf("do you want to enter more?");
    scanf("%d",&dummy);
    scanf("%c",&c);
    }while(c=='y');
}
tried removing int dummy variable and dummy input, program exits without taking any character input. how is this helping the code to not to exit ?
 
     
    