Write a program that allows the user to enter a number of quarters, dimes, and nickels and then outputs the monetary value of the coins in cents. For example, if the user enters 2 for the number of quarters, 3 for the number of dimes, and 1 for the number of nickels, then the program should output that the coins are worth 85 cents.

Respuesta :

Answer:

// Program is written in C++ Programming Language

// Comments are used for explanatory purpose

// Program Starts here

#include<iostream>

using namespace std;

int main ()

{

// Declare Variables

int quarter, dimes, nickel, cent;

// Enter values for each

cout<<"Quarter: ";

cin>>quarter;

cout<<"Dimes: ";

cin>>dimes;

cout<<"Nickels: ";

cin>>nickel;

/*

In the United States, these coins have the following values

Quarter = 25 cents

Done = 10 cents

Nickel = 5 cent

Total cent is calculated below

*/

cent = 25 * quarter + 10 * dimes + 5 * nickel;

// Print Total

cout<<"The coins are worth "<<cent<<" cents";

return 0;

}

ACCESS MORE