CSharp - Write program to Convert euro to dollar


Performing simple economic calculations for currency conversions,

Read an amount in euros and the euro exchange rate, you will convert the amount to dollars.


using System;
class Program/*ww  w  .  j  a  v  a  2  s. c o m*/
    static void Main(string[] args)
        // Inputs 
        Console.Write("Enter amount in euros: ");
        string inputEuros = Console.ReadLine();
        double amountEuros = Convert.ToDouble(inputEuros);

        Console.Write("Enter euro exchange rate (how many dollars per 1 euro): ");
        string inputExchangeRate = Console.ReadLine();
        double euroEchangeRate = Convert.ToDouble(inputExchangeRate);

        // Calculation 
        double amountDollars = amountEuros * euroEchangeRate;

        Console.WriteLine("Amount in dollars: " + amountDollars);