ulvis.paste.net

Paste Search Dynamic
Recent pastes
value of all your coins is
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.         int pen, nck, dim, qrt, hdl, dlr, total;
  6.         cout << "Please enter the number of pennies: ";
  7.         cin >> pen;
  8.         cout << "Please enter the number of nickels: ";
  9.         cin >> nck;
  10.         cout << "Please enter the number of dimes: ";
  11.         cin >> dim;
  12.         cout << "Please enter the number of quarters: ";
  13.         cin >> qrt;
  14.         cout << "Please enter the number of half-dollars: ";
  15.         cin >> hdl;
  16.         cout << "Please enter the number of dollars: ";
  17.         cin >> dlr;
  18.  
  19.         total = (1*pen)+(5*nck)+(10*dim)+(25*qrt)+(50*hdl)+(100*dlr);
  20.  
  21.         cout << "You have " << nck << " nickels." << endl;
  22.         cout << "You have " << dim << " dimes." << endl;
  23.         cout << "You have " << pen << " pennies." << endl;
  24.         cout << "You have " << qrt << " quarters." << endl;
  25.         cout << "You have " << hdl << " half-dollars." << endl;
  26.         cout << "You have " << dlr << " dollars." << endl;
  27.         cout << "The value of all your coins is " << total << " cents." << endl;
  28.         return 0;
  29. }
Parsed in 0.011 seconds