40. C Program to Count 500,100,50,10,5,1 notes for the given amount.
How does this program work?
- This program will give a introudction of array concept.
- Here by using the for loop concept we get the desired output.
Here is the code
#include <stdio.h>
int main(void)
{
int a[8]={500,100,50,20,10,5,2,1},n,n1,i;
printf("Enter the amount:");
scanf("%d",&n);
n1 = n;
for(i=0;i<8;i++)
{
printf("\n%d notes is:%d",a[i],n1/a[i]);
n1 = n1%a[i];
}
return 0;
}