Edwin, an enthusiastic kid visited the "Fun Fair Fest" along with his family. His father wanted him to purchase entry tickets from the counter for his family members. Being a little kid, he is just learning to understand about units of money. Edwin has paid some amount of money for the tickets, but he wants your help to give him back the change of Rs. N using minimum number of rupee notes.
Consider a currency system in which there are notes of seven denominations, namely, Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 50, Rs. 100. If the change given to Edwin Rs. N is input, write a program to compute smallest number of notes that will combine to give Rs. N.
Answers
Answered by
1
Answer:
//C++
#include<iostream>
using namespace std;
int main()
{
int n,n1,n2,n3,n4,n5,n6;
cin>>n;
n1=n/100; n=n%100;
n2=n/50; n=n%50;
n3=n/10; n=n%10;
n4=n/5; n=n%5;
n5=n/2; n=n%2;
n6=n;
cout<<n1+n2+n3+n4+n5+n6;
return 0;
}
Explanation:
Similar questions