Answer to Question #335629 in C++ for GANIZANI

Question #335629

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**


1
Expert's answer
2022-04-30T05:42:04-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS