Menu:

ADA (8) OOT (5)

Tuesday, April 12, 2016

Program to find minimum Number of coin in C

#include<iostream>
using namespace std;
int main()
{
int x,n,no=0,i,a[9]={1000,500,100,50,20,10,5,2,1};
cout<<"Enter amount:";
cin>>n;
for(i=0;i<=8;i++)
{
x=n/a[i];
no=no+x;
n=n%a[i];
}
cout<<"Number of coins required="<<no;
}

No comments:

Post a Comment