Hi guys really need your help. There is some problem with my code and i can't figure out whats the error.T his is my code:
#include<stdio.h>
void main(void)
{
float timeLeavingTP;
int transitNumber;
float transitTime;
printf("Please enter the time leaving TP.\n");
scanf_s("%f",&timeLeavingTP);
printf("Please enter bus number.\n");
scanf_s("%d",&transitNumber);
if(timeLeavingTP==1.00)
{
if(transitNumber==27)
{
printf("The time reached home is 1.54pm.\n");
}
if(transitNumber==8)
{
printf("The time reached home is 1.39pm.\n");
}
if(transitNumber==15)
{
printf("The time reached home is 1.42pm.\n");
}
}
else if(timeLeavingTP==6.30)
{
if(transitNumber==27)
{
printf("The time reached home is 7.32pm");
}
if(transitNumber==8)
{
printf("The time reached home is 7.29pm");
}
if(transitNumber==15)
{
printf("The time reached home is 7.28pm.\n");
}
}
}
After debugging i got
Please enter time leaving TP
1.00
Please enter bus number
27
The time reached home is 1.54pm
Another debugging
Please enter time leaving TP
6.30
Please enter bus number
27
Please enter any key to continue...
May i ask why did the 1.00 work and why the 6.30 do not work. Need your guys help. Thanks a lot!!