C Program to write Taxi Program Logic.
How does this program work?
- This code helps to how to write Taxi Program logic.
Here is the code
int main(void)
{
int c,t,s,e,d,to;
printf("Welcome to UBER\n");
printf("Choose Your Car Number:\n");
printf("1-> AP05 AE 8887\n");
printf("2-> AP05 CK 9875\n");
printf("3-> AP05 CY 2468\n");
scanf("%d",&c);
if(c==1)
{
printf("Enter the count of the trips:\n");
scanf("%d",&t);
printf("Enter the starting Kilometers of the day started:\n");
scanf("%d",&s);
printf("Enter the Ending Kilometers of the day ended:\n");
scanf("%d",&e);
d = e - s;
printf("Your Car Number is AP05 AE 8887\n");
printf("Total trips count:%d\n",t);
printf("Total Kilometers Driven today is:%dkm\n",d);
printf("Income per each kilometer: ₹ 8\n");
to = 8 * d;
printf("Total Income:%d\n",to);
}
else if(c==2)
{
printf("Enter the count of the trips:\n");
scanf("%d",&t);
printf("Enter the starting Kilometers of the day started:\n");
scanf("%d",&s);
printf("Enter the Ending Kilometers of the day ended:\n");
scanf("%d",&e);
d = e - s;
printf("Your Car Number is AP05 AR 9875\n");
printf("Total trips count:%d\n",t);
printf("Total Kilometers Driven today is:%dkm\n",d);
printf("Income per each kilometer: ₹ 8\n");
to = 8 * d;
printf("Total Income:%d\n",to);
}
else if(c==3)
{
printf("Enter the count of the trips:\n");
scanf("%d",&t);
printf("Enter the starting Kilometers of the day started:\n");
scanf("%d",&s);
printf("Enter the Ending Kilometers of the day ended:\n");
scanf("%d",&e);
d = e - s;
printf("Your Car Number is AP05 CY 2468\n");
printf("Total trips count:%d\n",t);
printf("Total Kilometers Driven today is:%dkm\n",d);
printf("Income per each kilometer: ₹ 8\n");
to = 8 * d;
printf("Total Income:%d\n",to);
}
else
{
printf("Wrong Input");
}
}