Write a program to calculate total cost of apples.the number of apples and cost per apples is entered by the user
#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;
}
Comments
Leave a comment