Wednesday, January 16, 2008

Covert Rupees To there Corresponding Notes

Easy One

import java.io.*;
class RupeesToNotes
{
public static void main(String args[])throws IOException
{
int amt,p20,p10,p5,p2,p1;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println(" enter the amount ");
amt = Integer.parseInt(br.readLine());
p20 = amt/20;
amt = amt%20;
System.out.println("20 X " + p20);
p10 = amt/10;
amt = amt%10;
System.out.println("10 X " + p10);
p5 = amt/5;
amt = amt%5;
System.out.println("5 X " + p5);
p2 = amt/2;
amt = amt%2;
System.out.println("2 X " + p2);
p1 = amt;
System.out.println("1 X " + p1);
}
}

No comments: