A program to read an amount (integer value) and break the amount into the smallest possible number of bank notes.

Here, we have a basic program example to break the user input amount into smallest possible number of bank notes using different languages. This program is created in c language, c++, Java, and Python.

Note: The possible banknotes are 100, 50, 20, 10, 5, 2 and 1.

Program to break the amount into smallest bank notes in C language

#include <stdio.h>
int main() {
	int amt, total;
	printf("Input the amount: ");
	scanf("%d",&amt);
	total = (int)amt/100;

	printf("There are: ");
	printf("\n%d Note(s) of 100.00\n", total);

	amt = amt-(total*100);
	total = (int)amt/50;
	printf("%d Note(s) of 50.00\n", total);

	amt = amt-(total*50);
	total = (int)amt/20;
	printf("%d Note(s) of 20.00\n", total);

	amt = amt-(total*20);
	total = (int)amt/10;
	printf("%d Note(s) of 10.00\n", total);

	amt = amt-(total*10);
	total = (int)amt/5;
	printf("%d Note(s) of 5.00\n", total);

	amt = amt-(total*5);
	total = (int)amt/2;
	printf("%d Note(s) of 2.00\n", total);

	amt = amt-(total*2);
	total = (int)amt/1;
	printf("%d Note(s) of 1.00\n", total);

	return 0;
}

Program to break the amount into smallest bank notes in C++ language

#include<iostream>
#include<stdlib.h>
#include<cmath>
using namespace std;
int main() {
	int amt, total;
	cout<<"Input the amount: ";
	cin>>amt;
	total = (int)amt/100;

	cout<<"There are: ";
	cout<<total<<"Note(s) of 100.00\n"<<total;

	amt = amt-(total*100);
	total = (int)amt/50;
	cout<<total<<"Note(s) of 50.00\n"<<total;

	amt = amt-(total*50);
	total = (int)amt/20;
	cout<<total<<"Note(s) of 20.00\n"<<total;

	amt = amt-(total*20);
	total = (int)amt/10;
	cout<<total<<"Note(s) of 10.00\n"<<total;

	amt = amt-(total*10);
	total = (int)amt/5;
	cout<<total<<"Note(s) of 5.00\n"<<total;

	amt = amt-(total*5);
	total = (int)amt/2;
	cout<<total<<"Note(s) of 2.00\n"<<total;

	amt = amt-(total*2);
	total = (int)amt/1;
    cout<<total<<"Note(s) of 1.00\n"<<total;
	return 0;
}

Program to break the amount into smallest bank notes in Python language

amt=int(input("enter the amount: "))
total = amt/100;

print("There are :")
print(total,"Note(s) of 100.00")

amt=amt-(total*100)
total=amt/50
print(total,"Notes(s) of 50.00")

amt=amt-(total*50)
total=amt/20
print(total,"Notes(s) of 20.00")

amt=amt-(total*20)
total=amt/10
print(total,"Notes(s) of 10.00")
amt=amt-(total*10)
total=amt/5
print(total,"Notes(s) of 5.00")
amt=amt-(total*5)
total=amt/2
print(total,"Notes(s) of 2.00")
amt=amt-(total*2)
total=amt/1
print(total,"Notes(s) of 1.00")

Program to break the amount into smallest bank notes in Java language

import java.util.Scanner;
public class amount
    {
          public static void main(String args[])
             {
                 int amt, total;
                 Scanner sc = new Scanner(System.in);
                 System.out.print("Enter the amount:  ");
                 amt=sc.nextInt();

                 total = amt/100;
                 System.out.println("There are: ");
                 System.out.println(total + "Notes(s) of 100.00");

                 amt = amt-(total*100);
                 total = amt/50;
                 System.out.println(total + "Notes(s) of 50.00");

                 amt = amt-(total*50);
                 total = amt/20;
                 System.out.println(total + "Notes(s) of 20.00");
		
                 amt = amt-(total*20);
                 total = amt/10;
                 System.out.println(total + "Notes(s) of 10.00");

                 amt = amt-(total*10);
                 total = amt/5;
                 System.out.println(total + "Notes(s) of 5.00");
	
                  amt = amt-(total*5);
                  total = amt/2;
                 System.out.println(total + "Notes(s) of 2.00");

                 amt = amt-(total*2);
                 total = amt/1;
                 System.out.println(total + "Notes(s) of 1.00");
         }
}