Practical : 10
Subject : .NET
Aim : Write a C# code to Convert following currency conversion.
Rupees to dollar, frank, euro.
Rupees to dollar, frank, euro.
Code:
using System;
class Program
{
static void Main(string[] args)
{
while (true)
{
Console.WriteLine("Enter your Choice : ");
Console.WriteLine("1. Rupees to Franc");
Console.WriteLine("2. Rupees to dollor");
Console.WriteLine("3. Rupees to euro");
Console.WriteLine("4. Exit");
int choice = int.Parse(Console.ReadLine());
switch (choice)
{
case 1:
franc();
break;
case 2:
dollor();
break;
case 3:
euro();
break;
case 4:
break;
default:
Console.WriteLine("Enter valid choice");
break;
}
if (choice == 4)
break;
}
Console.ReadKey();
}
static void franc()
{
Console.WriteLine("Enter amount in Rupees:");
double r = double.Parse(Console.ReadLine());
double f = r / 66.77;
Console.Write("franc :\t{0}\n", f);
}
static void dollor()
{
Console.WriteLine("Enter amount in Rupees:");
double r = double.Parse(Console.ReadLine());
double d = r / 68.06;
Console.Write("dollor :{0}\n", d);
}
static void euro()
{
Console.WriteLine("Enter amount in Rupees:");
double r = double.Parse(Console.ReadLine());
double e = r / 71.38;
Console.Write("euro :\t{0}\n", e);
}
}
class Program
{
static void Main(string[] args)
{
while (true)
{
Console.WriteLine("Enter your Choice : ");
Console.WriteLine("1. Rupees to Franc");
Console.WriteLine("2. Rupees to dollor");
Console.WriteLine("3. Rupees to euro");
Console.WriteLine("4. Exit");
int choice = int.Parse(Console.ReadLine());
switch (choice)
{
case 1:
franc();
break;
case 2:
dollor();
break;
case 3:
euro();
break;
case 4:
break;
default:
Console.WriteLine("Enter valid choice");
break;
}
if (choice == 4)
break;
}
Console.ReadKey();
}
static void franc()
{
Console.WriteLine("Enter amount in Rupees:");
double r = double.Parse(Console.ReadLine());
double f = r / 66.77;
Console.Write("franc :\t{0}\n", f);
}
static void dollor()
{
Console.WriteLine("Enter amount in Rupees:");
double r = double.Parse(Console.ReadLine());
double d = r / 68.06;
Console.Write("dollor :{0}\n", d);
}
static void euro()
{
Console.WriteLine("Enter amount in Rupees:");
double r = double.Parse(Console.ReadLine());
double e = r / 71.38;
Console.Write("euro :\t{0}\n", e);
}
}
Output:
Sign up here with your email
ConversionConversion EmoticonEmoticon