# C++ Program to Count Total Notes in an Amount

Write a C++ Program to Count Total Notes in an Amount with an example. First, we declared an array of available notes and then assigned the user entered amount to temp value. Next, we used for loop to iterate that notes array and finding the total notes in the given cash.

```#include<iostream>
using namespace std;

int main()
{
int a = {1000, 500, 100, 50, 20, 10, 5, 2, 1};
int amount, i, temp;

cout << "\nPlease Enter the Amount of Cash =  ";
cin >> amount;

temp = amount;

for(i = 0; i < 9; i++)
{
cout << a[i] <<" Notes is = " << temp / a[i] << endl;
temp = temp % a[i];
}

return 0;
}```

## C++ Program to Count Total Notes in an Amount using Functions

```#include<iostream>
using namespace std;

void totalNotes(int amount)
{
int a = {1000, 500, 100, 50, 20, 10, 5, 2, 1};
int i, temp;

temp = amount;

for(i = 0; i < 9; i++)
{
cout << a[i] <<" Notes is =  " << temp / a[i] << endl;
temp = temp % a[i];
}
}
int main()
{
int amount;

cout << "\nPlease Enter the Amount of Cash =  ";
cin >> amount;

totalNotes(amount);

return 0;
}```
``````Please Enter the Amount of Cash =  876592
1000 Notes is =  876
500 Notes is =  1
100 Notes is =  0
50 Notes is =  1
20 Notes is =  2
10 Notes is =  0
5 Notes is =  0
2 Notes is =  1
1 Notes is =  0``````

C++ Program to Count the total number of notes in a given amount using multiple If statements.

```#include<iostream>
using namespace std;

int main()
{
int amount;

int note500, note100, note50, note20, note10, note5, note2, coin1;
note500 = note100 = note50 = note20 = note10 = note5 = note2 = coin1 = 0;

cout << "\nPlease Enter the Amount of Cash =  ";

cin >> amount;
if (amount > 500)
{
note500 = amount / 500;
amount = amount - (note500 * 500);
}
if (amount >= 100)
{
note100 = amount / 100;
amount = amount - (note100 * 100);
}
if (amount >= 50)
{
note50 = amount / 50;
amount = amount - (note50 * 50);
}
if (amount >= 20)
{
note20 = amount / 20;
amount = amount - (note20 * 20);
}
if (amount >= 10)
{
note10 = amount / 10;
amount = amount - (note10 * 10);
}
if (amount >= 5)
{
note5 = amount / 5;
amount = amount - (note5 * 5);
}
if (amount >= 2)
{
note2 = amount / 2;
amount = amount - (note2 * 2);
}
if (amount >= 1)
{
coin1 = amount;
}
cout << "\nTotal Number of Notes present in the Cash that you entered are \n";
cout << "\n500 Notes  =  " << note500;
cout << "\n100 Notes  =  " << note100;
cout << "\n50 Notes   =  " << note50;
cout << "\n20 Notes   =  " << note20;
cout << "\n10 Notes   =  " << note10;
cout << "\n5 Notes    =  " << note5;
cout << "\n2 Notes    =  " << note2;
cout << "\n1 Coin     =  " << coin1;

return 0;
}```
``````Please Enter the Amount of Cash =  2156781

Total Number of Notes present in the Cash that you entered are

500 Notes  =  4313
100 Notes  =  2
50 Notes   =  1
20 Notes   =  1
10 Notes   =  1
5 Notes    =  0
2 Notes    =  0
1 Coin     =  1``````