C# Program to Perform Currency Conversions

This is a C# Program to perform currency conversions.

Problem Description

This C# Program Perfoms Currency Conversions.

Problem Solution

Here the currency conversions are made based on the choice that is given by the user and the conversions are made based on the exchange value and the corresponding value is displayed.

Program/Source Code

Here is source code of the C# Program to Perfom Currency Conversions. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.

/*
 * C# Program to Perfom Currency Conversions
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Program
{
    class Program
    {
        static void Main(string[] args)
        {
            int choice;
            Console.WriteLine("Enter your Choice :\n 1- Dollar to Rupee \n 
                               2- Euro to Rupee \n 3- Malaysian Ringgit to Rupee ");
            choice = int.Parse(Console.ReadLine());
            switch (choice)
            {
            case 1:
                 Double dollar, rupee,val;
                 Console.WriteLine("Enter the Dollar Amount :");
                 dollar = Double.Parse(Console.ReadLine());
                 Console.WriteLine("Enter the Dollar Value :");
                 val = double.Parse(Console.ReadLine());
                 rupee = dollar * val;
                 Console.WriteLine("{0} Dollar Equals {1} Rupees", dollar, rupee);
                 break;
            case 2:
                 Double Euro, rupe,valu;
                 Console.WriteLine("Enter the Euro Amount :");
                 Euro = Double.Parse(Console.ReadLine());
                 Console.WriteLine("Enter the Euro Value :");
                 valu = double.Parse(Console.ReadLine());
                 rupe = Euro * valu;
                 Console.WriteLine("{0} Euro Equals {1} Rupees", Euro, rupe);
                 break;
            case 3:
                 Double ringit, rup,value;
                 Console.WriteLine("Enter the Ringgit Amount :");
                 ringit = Double.Parse(Console.ReadLine());
                 Console.WriteLine("Enter the Ringgit Value :");
                 value = double.Parse(Console.ReadLine());
                 rup = ringit * value;
                 Console.WriteLine("{0} Malaysian Ringgit Equals {1} Rupees", 
                                   ringit, rup);
                 break;
           }
           Console.ReadLine();
        }
    }
}
Program Explanation

This C# program is used to perform currency conversions. Here the currency conversions are made based on the choice that is given by the user and the conversions are made based on the exchange value and the corresponding value is displayed.

advertisement
advertisement
Runtime Test Cases
 
Enter the Choice :
 1 - Dollar to Rupee
 2 - Euro to Rupee
 3 - Malaysian Ringgit to Rupee
1
Enter the Dollar Amount : 20
Enter the Dollar Value  : 62.58
20 Dollar Equals 1251.6 Rupees

Sanfoundry Global Education & Learning Series – 1000 C# Programs.

If you wish to look at all C# Programming examples, go to 1000 C# Programs.

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.