People park their car outside a shopping mall and pay car stand rent. For 2 hours , the rent is 10 $. After 2 hours, the rate will be 20 $. Write a program that calculates the total bill of a car.
Sample Output:
Enter Total Hours = 6Your Total Bill = $100
#include <stdio.h>
#include <conio.h>
void main()
{
int hours=0;
int bill=0;
printf("Enter Total Hours = ");
scanf("%d",&hours);
if(hours<=2)
{
bill=10;
printf("Your Total Bill = $%d",bill);
}
else
{
bill=(2*10)+((hours-2)*20);
printf("Your Total Bill = $%d",bill);
}
getch();
}
{[['
']]}

0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.