Answer:
#include<iostream>
using namespace std;
void computeCoin(int coinValue, int& number, int& amountLeft)
{
number = amountLeft / coinValue;
amountLeft = amountLeft % coinValue;
}
int main()
{
int cents;
int number;
char ch;
do
{
cout << "Enter no of cents. :";
cin >> cents;
while(cents<1 || cents >99)
{
cout << "Invalid cents entered. Re-Enter no of cents. :";
cin >> cents;
}
cout << cents <<" can be given as ";
computeCoin(25,number,cents);
if(number)
cout << number << " quarters ";
computeCoin(10,number,cents);
if(number)
cout << number << " dimes and ";
cout << cents << " penny"<<endl;
cout<< "do u want to continue enter y or n :";
cin >> ch;
}while(ch=='y');
return 0;
}
Explanation: