Java Program to Convert Dollars into Rupees

In this post, we will learn to code the Java Program to Convert Dollars into Rupees. Let’s understand Dollars to Rupees conversion and we will learn How to convert Dollars to Rupees in Java Programming Language.

Dollars to Rupees Conversion

We convert USD to INR, i.e. Dollars to Rupees. The current value of 1 USD in INR is Rs 74.72 and 1 INR is 0.013 USD.

Now, let’s see the Java Program to Convert Dollars into Rupees.

Java Program to Convert Dollars into Rupees

import java.util.*;

public class Main{
    
    
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        System.out.println("Enter the Amount in USD: ");
        double USD = sc.nextDouble();
        
        double INR = 74.42 * USD;
        
        System.out.println(""+USD+" USD in INR is equal to Rs "+INR);
        
    }
    
}

Output

Enter the Amount in USD: 1500

1500.0 USD in INR is equal to Rs 111630.0

How Does This Program Work ?

        Scanner sc = new Scanner(System.in);
        System.out.println("Enter the Amount in USD: ");
        double USD = sc.nextDouble();

In this Program, first, we take the input of the amount in USD (Dollars) from the user as input using the Scanner Class in Java.

        double INR = 74.42 * USD;

Then, we convert the amount from Dollars to Rupees by multiplying 74.42(current value) and the amount in USD.

        System.out.println(""+USD+" USD in INR is equal to Rs "+INR);

Then, we display the result using the System.out.println() function.

This is the Java Program to Convert Dollars into Rupees.

Conclusion

I hope after going through this post, you understand Java Program to Convert Dollars into Rupees.
If you have any doubt regarding the topic, feel free to contact us in the Comment Section. We will be delighted to help you.

Also Read:

Leave a Comment

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