.Net Practical 3

Practical : 3
Subject : .Net

Aim : C# code to Convert currency conversion. Rupees to dollar, Euro, Pound, Yen.

Source Code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace dotnet008
{
    class pra3
    {
        static void Main(string[] args)
        {
            string d;
            do
            {
                Console.WriteLine("1)Rs->$ \n2)$->Rs \n3)Rs->Euro \n4)Rs->Pound \n5)Rs->Yen\n");
                Console.Write("select your choice : ");
                int i = Convert.ToInt32(Console.ReadLine());
                switch (i)
                {
                    case 1:
                        Console.Write("enter Rs :");
                        int rs = Convert.ToInt32(Console.ReadLine());
                        int dr = (rs / 75);
                        Console.WriteLine("$ : " + dr);
                        break;
                    case 2:
                        Console.Write("Enter $");
                        dr = Convert.ToInt32(Console.ReadLine());
                        rs = dr * 75;
                        Console.WriteLine("Rs : " + rs);
                        break;
                    case 3:
                        Console.Write("enter Rs :");
                        rs = Convert.ToInt32(Console.ReadLine());
                        float euro = (rs / 78.65f);
                        Console.WriteLine("Euro : " + euro);
                        break;
                    case 4:
                        Console.Write("enter Rs :");
                        rs = Convert.ToInt32(Console.ReadLine());
                        float po = (rs / 92.70f);
                        Console.WriteLine("Pound : " + po);
                        break;
                    case 5:
                        Console.Write("enter Rs :");
                        rs = Convert.ToInt32(Console.ReadLine());
                        float yen = rs * 1.92f;
                        Console.WriteLine("Yen : " + yen);
                        break;
                }
                Console.Write("Do You Want to Continue(y/n)?");
                d = Console.ReadLine();
            } while (d == "y" || d == "Y");
            Console.ReadKey();
        }
    }
}
Output :

Pratik Boghani

Author & Editor

Life is all about the next step.

0 comments:

Post a Comment