C# program to convert the US dollar into Indian rupees

Here, we are going to learn how to convert the US dollar into Indian rupees in C#?
Submitted by Nidhi, on September 14, 2020

Here we will read the amount into the US dollar and then enter the current value of the US dollar and then convert the amount into Indian rupees.

Program:

The source code to convert the US dollar into Indian rupees is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.

//C# program to convert US dollar into Indian rupees.

using System;

class Program
{
    static void Main(string[] args)
    {
            
        double usd    = 0;
        double inr    = 0;
        double value  = 0;
            
        Console.Write("Enter amount in USD: ");
        usd = double.Parse(Console.ReadLine());
            
        Console.Write("Enter the USD value :");
        value = double.Parse(Console.ReadLine());
           
        inr = usd * value;
        Console.WriteLine("USD "+usd+"-> INR "+inr);
    }
}

Output:

Enter amount in USD: 35.2
Enter the USD value :72.3
USD 35.2-> INR 2544.96
Press any key to continue . . .

Explanation:

In the above program, we created a class Program that contains the Main() method. In the Main() method, we read the amount into the US dollar and then enter the current value of the US dollar and then convert the amount into Indian rupees.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.