Write a program to calculate the parking charges of a vehicle. Input type (a character: ‘c’ for car, ‘b’ for
bus,‘s’ for scooter/ motorcycle/ cycle) and the number of hours. The charges are as follows:-
Truck/ Bus – Rs. 50 per hour
Car – Rs. 25 per hour
Scooter/ MotorCycle/ Cycle – Rs.10 per hour
Answers
Answered by
0
Answer:
The charges of 85
Answered by
2
Write a program to calculate the parking charges of a vehicle. Input type (a character: ‘c’ for car, ‘b’ for bus,‘s’ for scooter/ motorcycle/ cycle) and the number of hours.
Explanation:
C program
#include<stdio.h>
void main()
{
int car=25,bus=50,SMC=10,noofhours,fine=0;
char ch;
printf("Please enter type of vehicle, c-car b-bus and s-Scooter/ MotorCycle/ Cycle::");
scanf("%c",&ch);
printf("Please enter no of hours");
scanf("%d",&noofhours);
if(ch=='c')
{
fine=car*noofhours;
}
else if(ch=='b')
{
fine=bus*noofhours;
}
else if(ch=='s')
{
fine=SMC*noofhours;
}
printf("parking charges of a vehicle is %d",fine);
}
Output
Please enter type of vehicle, c-car b-bus and s-Scooter/ MotorCycle/ Cycle::c
Please enter no of hours5
parking charges of a vehicle is 125
Similar questions
India Languages,
5 months ago
Math,
11 months ago
Physics,
1 year ago
Hindi,
1 year ago
English,
1 year ago