Java Program to count Currency needed for a Entered Money

import java.util.*;
class scan
{
 public static void main(String arg[])
  {
   int x,y,z,q,w;
   Scanner kb=new Scanner(System.in);
   System.out.println("Enter Amount in Rupees");
   x=kb.nextInt();
   y=x/100;
   x=x%100;
   z=x/50;
   x=x%100;
   q=x/10;
   x=x%10;
   w=x;
   
   if(y==0)
   {
   
   System.out.println("50 Rupees note needed:- "+z);
   System.out.println("10 Rupees note needed:- "+q);
   System.out.println("1 Rupee note needed:- "+w);
   }
   
   else if(z==0)
   {
	System.out.println("100 Rupees note needed:- "+y);
   System.out.println("10 Rupees note needed:- "+q);
   System.out.println("1 Rupee note needed:- "+w);
   }
   
   else if(q==0)
   {
	System.out.println("100 Rupees note needed:- "+y);
   System.out.println("50 Rupees note needed:- "+z);
   System.out.println("1 Rupee note needed:- "+w);
   }

   else if(w==0)
   {
	System.out.println("100 Rupees note needed:- "+y);
   System.out.println("50 Rupees note needed:- "+z);
   System.out.println("10 Rupees note needed:- "+q);
   }
   
	 
  }
}

OUTPUT:-

Currency

Leave a Reply

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