Write a program to help you calculate the amount of money that your customers have to
pay depending on how long they have used your computer (in hours).
first one hour = 1.20
subsequent hour = 0.80
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the number of hours you have been using the computer:\n";
cin>>n;
double amountToPay = 1.2;
for(int i= 1; i<n; i++){
amountToPay += 0.8;
}
cout<<"You should pay "<<amountToPay<<endl;
}
Comments
Leave a comment