if ile Dört İşlem Yapan Program
Daha önce bunun daha basitini yapmıştım. Şimdi de if ile olanını yaptım.
////////////////////Cihan TURGUT//////////////////////
/////////if ile Dört İşlem Yapan Program/////////////
using System;
using System.Collections.Generic;
using System.Text;namespace deneme
{
class Program
{
static void Main(string[] args)
{
int a, b;
int cevap;aConsole.WriteLine(”1 – Topla”);
Console.WriteLine(”2 – Çıkarma”);
Console.WriteLine(”3 – Çarpma”);
Console.WriteLine(”4 – Bölme”);
Console.WriteLine(”5 – Mod”);Console.WriteLine(”1. sayı giriniz”);
a = Convert.ToInt16(Console.ReadLine());Console.WriteLine(”2. sayı giriniz”);
b = Convert.ToInt16(Console.ReadLine());Console.WriteLine(”Hangi islemi yapmak istiyorsunuz”);
cevap = Convert.ToInt16(Console.ReadLine());if (cevap == 1)
{
Console.WriteLine(”toplam={0}”, a + b);} if (cevap == 2)
{
Console.WriteLine(”fark={0}”, a – b);} if (cevap == 3)
{
Console.WriteLine(”carpma={0}”, a * b);} if (cevap == 4)
{
Console.WriteLine(”bolme={0}”, a / b);} if (cevap == 5)
{
Console.WriteLine(”mod={0}”, a % b);
}}
}
}
if ile Dört İşlem Yapan Program
Filed under: CSharp
Leave a Reply
You must be logged in to post a comment.