denomination

Solutions on MaxInterview for denomination by the best coders in the world

showing results for - "denomination"
Carla
13 Nov 2020
1import java.util.Scanner;
2
3/*Program By Ghanendra Yadav
4   Visit http://www.programmingwithbasics.com/
5*/
6
7public class denomination
8{
9    public static void main(String args[])
10    {
11        int amt, r2000=0, r500=0, r100=0, r50=0, r20=0, r10=0, r5=0, r2=0 , r1=0 ,count=0; 
12        Scanner sc = new Scanner(System.in);
13 
14        System.out.print("Enter The Amount in Rupees : \n\n");
15        amt = sc.nextInt();
16 
17    while(amt >= 2000) 
18 { 
19  r2000 = amt / 2000 ; 
20  amt = amt % 2000;
21  System.out.print("\nTotal Number Of 2000 Rupees Notes :"+ r2000) ;
22  break ; 
23 }
24 while(amt >= 500) 
25 { 
26  r500 = amt / 500 ; 
27  amt = amt % 500;
28  System.out.print("\nTotal Number Of 500 Rupees Notes : "+ r500) ;
29  break ; 
30 } 
31 while(amt >= 100) 
32 { 
33  r100 = amt / 100 ; 
34  amt = amt % 100;
35  System.out.print("\nTotal Number Of 100 Rupees Notes : "+ r100) ;
36  break ; 
37 } 
38 while(amt >= 50) 
39 { 
40  r50 = amt / 50 ;
41  amt = amt % 50; 
42  System.out.print("\nTotal Number Of 50 Rupees Notes : "+ r50) ; 
43  break ; 
44 }  
45 while(amt >= 20) 
46 { 
47  r20 = amt / 20 ; 
48  amt = amt % 20;
49  System.out.print("\nTotal Number Of 20 Rupees Notes : "+ r20) ; 
50  break ; 
51 }  
52 while(amt >= 10) 
53 { 
54  r10 = amt / 10 ; 
55  amt = amt % 10;
56  System.out.print("\nTotal Number Of 10 Rupees Notes Or Coin : "+ r10) ; 
57  break ; 
58 } 
59 while(amt >= 5) 
60 { 
61  r5 = amt / 5 ; 
62  amt = amt % 5;
63  System.out.print("\nTotal Number Of 5 Rupees Notes Or Coin : "+ r5) ; 
64  break ; 
65 } 
66 while(amt >= 2) 
67 { 
68  r2 = amt / 2 ; 
69  amt = amt % 2;
70  System.out.print("\nTotal Number Of 2 Rupees Notes Or Coin : "+ r2) ; 
71  break ; 
72 } 
73 while(amt >= 1) 
74 { 
75  r1 = amt / 1 ; 
76  amt = amt % 1;
77  System.out.print("\nTotal Number Of 1 Rupees Note Or Coin : "+ r1) ; 
78  break ; 
79 }
80 count = r2000 + r500 + r100 + r50 + r20 + r10 + r5 + r2 + r1;   
81 System.out.print("\n\nTotal Number Of Notes Require : \n\n"+ count) ; 
82 }
83}
84
similar questions
queries leading to this page
denomination