.Write a program that inputs amount in rupees find and print it how many 100,50,20,10,5,2,1 rupee notes could be made.

public static void main(String[] args) {
Scanner cin=new Scanner(System.in);
int rs,hundred,fifty,twenty,ten,five,two,one;
System.out.println(“Enter rupees=”);
rs=cin.nextInt();
hundred=rs/100;
rs=rs%100;
fifty=rs/50;
rs=rs%50;
twenty=rs/20;
rs=rs%20;
ten=rs/10;
rs=rs%10;
five=rs/5;
rs=rs%5;
two=rs/2;
one=rs%2;
System.out.println(“hundred ruppes are”+hundred);
System.out.println(“Fifty ruppes are”+fifty);
System.out.println(“Twenty ruppes are”+twenty);
System.out.println(“Ten ruppes are”+ten);
System.out.println(“Five ruppes are”+five);
System.out.println(“Two ruppes are”+two);
System.out.println(“One ruppes are”+one);

}

}

Output:

run:
Enter rupees=
5322
hundred ruppes are53
Fifty ruppes are0
Twenty ruppes are1
Ten ruppes are0
Five ruppes are0
Two ruppes are1
One ruppes are0
BUILD SUCCESSFUL (total time: 6 seconds)

Leave a Reply

Your email address will not be published. Required fields are marked *