#include <iostream>
using namespace std;
int main()
{
int hours;
double totalCost ;
cout << "Enter the number of hours of car parking : ";
cin >> hours ;
if(hours > 1){
totalCost = 2.0 + (hours - 1) * 1.0 ;
}
else if(hours == 1){
totalCost = 2.0;
}
else{
totalCost = 0 ;
}
cout << "The total cost is : RM " << totalCost << endl ;
return 0;
}
Comments
Leave a comment