//Currency Denominations of 100,50 and 10
import java.util.Scanner;
class Currency {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter amount which can be denominated in 10:");
long a=sc.nextLong();
if(a<0 || a%10!=0)
System.out.println("Invalid Input");
else
{
System.out.println("Denominations of 100:"+(a/100));
a=a%100;
System.out.println("Denominations of 50:"+(a/50));
a=a%50;
System.out.println("Denominations of 10:"+(a/10));
}
}
}
import java.util.Scanner;
class Currency {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter amount which can be denominated in 10:");
long a=sc.nextLong();
if(a<0 || a%10!=0)
System.out.println("Invalid Input");
else
{
System.out.println("Denominations of 100:"+(a/100));
a=a%100;
System.out.println("Denominations of 50:"+(a/50));
a=a%50;
System.out.println("Denominations of 10:"+(a/10));
}
}
}
No comments:
Post a Comment