Programlama öğrenmek için her zaman yeni örnekler denemelisiniz. Bunun için bugün sizlere C# ile Dönüştürücü Programı örneğini aktaracağız. Console nasıl Kullanılır? C# ile Dönüştürücü Programı nasıl yapılır? Gibi sorularınızın cevabını bu içerikte bulabilirsiniz.
Kod Alanı
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;// www.programlamahocam.com
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
double sonuc;
string devam;
Console.WriteLine(“******* www.programlamahocam.com *******n”);
do
{
Console.WriteLine(“******* 1-inc –> cm *******”);
Console.WriteLine(“******* 2-kg –> lbs *******”);
Console.WriteLine(“******* 3-Celcius –> Fahrenheit *******”);
Console.Write(” Seçiminiz (1-3) : “);
string secim = Console.ReadLine();
Console.Write(“Çevirelecek değeri giriniz = “);
double deger = Convert.ToDouble(Console.ReadLine());
if (secim == “1”)
{
sonuc = deger * 2.54;
Console.WriteLine(“{0} inç {1} cm’dir”,deger,sonuc);
}
else if (secim == “2”)
{
sonuc = deger * 2.2046226218488;
Console.WriteLine(“{0} kg {1} lbs’dir”, deger, sonuc);
}
else if (secim == “3”)
{
sonuc = deger * 33.8;
Console.WriteLine(“{0} Celceus {1} Fahrenheit’dir”, deger, sonuc);
}
else Console.WriteLine(” ******* Yanlış Seçim *********”);
Console.Write(“Devam Etmek istermisiniz (E/H) : “);
devam = Console.ReadLine();
} while (devam==”E” || devam==”e”);
// www.programlamahocam.com
}
}
}
