Monday 9 June 2014

Program to find cash denomination

// program to find cash denomination
import javax.swing.*;
public class cash
{
public static void main(String[] args) {
int a1,a2,b1,b2,c1,c2,d1,n;
n=Integer.parseInt(JOptionPane.showInputDialog("enter the amount"));
        a1=n/100;
                a2=n%100;
                b1=a2/50;
                b2=a2%50;
                c1=b2/20;
                c2=b2%20;
                d1=c2/10;
        System.out.println("100 rupee notes= "+a1);
                System.out.println("50 rupee notes= "+b1);
                System.out.println("20 rupee notes= "+c1);
                System.out.println("10 rupee notes= "+d1);
}
}


output:
enter the amount 550
100 rupee notes= 5
50 rupee notes= 1
20 rupee notes= 0
10 rupee notes= 0

No comments:

Post a Comment

SAY HELLO!!