Answer to Question #310817 in C++ for Diya

Question #310817

Write a program to calculate total cost of apples.the number of apples and cost per apples is entered by the user


1
Expert's answer
2022-03-15T02:57:36-0400
#include <iostream>
using namespace std;

int main() {
    int num_apples;
    double price;
    double total;

    cout << "Enter a number of apples: ";
    cin >> num_apples;
    cout << "Enter a price of an apple: ";
    cin >> price;

    total = num_apples * price;
    cout << "The total cost of apples is " << total << 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