Change your code to
if(ch=='d')
{
printf("\n\n\tEnter a number ");
scanf("%f", &num2);
if(num2==0)
{
printf("\n\n\tZero divisor");
printf("\n\tHit a key to end the program");
getch();
system("cls");
exit(0);
}
else if(num2!=0)
{
printf("\n\n\tEnter another number ");
scanf("%f", &num3);
printf("\n\n\tPlease divide the two numbers ");
scanf("%f", &result1);
}
}
2
solved if statement not working properly? [closed]