Write a C++ program that prompts the user for the fuel quantity and the fuel price per litre. The program should then print a fuel receipt like the one below: Receipt ======= Volume: 15.50 L Litre Price: MK 1380.50/L ------------ To be Paid: MK 21,397.75 ***End of receipt**
#include <iostream>
using namespace std;
int main(){
cout << "Enter the fuel quantity: ";
float quantity;
cin >> quantity;
cout << endl;
cout << "Enter the fuel price per litre: ";
float price;
cin >> price;
cout << endl;
double result;
result = price * quantity;
cout << endl;
cout << "Receipt ================: " << endl;
cout << "Volume: " << quantity << " L Litre" << endl;
cout << "Price: MK " << price << "/L" << endl;
cout << "------------------------ " << endl;
cout << "To be Paid: MK " << result << endl;
cout << "*****End of receipt*****" << endl;
return 0;
}
Comments
Leave a comment