
programming in java to find the number of different notes and coins in given amount by user

import java.util.*;
class NotesAndCoins
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("System.out.print: ");
int amount=input.nextInt();
int thousand, five_hundred, hundred, fifty, ten, five,two,one;
System.out.println(" DISTRIBUTION OF MONEY "+amount+" rupees ");
thousand=amount/1000;
amount=amount - (thousand*1000);
five_hundred=amount/ 500;
amount=amount - (five_hundred*500);
hundred=amount/100;
amount=amount - (hundred*100);
fifty=amount/50;
amount=amount - (fifty*50);
ten=amount/10;
amount=amount - (ten*10);
five=amount/5;
amount=amount - (five*5);
two=amount/2;
amount=amount - (two*2);
one=amount/1;
amount=amount - (one*1);
System.out.println(" Thousand Rupee Note = "+thousand);
System.out.println(" Five Hundred Rupee Note = "+five_hundred);
System.out.println(" Hundred Rupee Note = "+hundred);
System.out.println(" Fifty Rupee Note = "+fifty);
System.out.println(" Ten Rupee Note = "+ten);
System.out.println(" Five Rupee Note = "+five);
System.out.println(" Two Rupee Coin = "+two);
System.out.println(" One Rupee Coin = "+one);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.