I have a task named ''Discounted Coffee Machine'' with these conditions:
if(p<a){
printf("\nYour balance is not enough.");
printf("\nRemaining balance: %d",p);
}
else if(p>=a && dis!=dis2){
printf("\nEnjoy your Latte. ");
printf("\nRemaining balance: %d",p-a);
}
else if(p>=a && dis==dis2){
printf("\nThe discount has been applied.\nEnjoy your Latte.");
printf("\nRemaining balance: %f",(float)p-(float)a*0.9);
}
But, if I enter the correct discount code, it doesn't read the second else if. It only reads the first else if. How can I solve this?
I tried with the second else if like only else, but it's not working. I also tried with ',' and '||'.