Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

using System;

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

namespace Calculator1
{
class Program
{
static void Main(string[] args)
{
double b1;
double b2;
string opr, ulang;

double result=0;

Console.ReadKey();
Console.WriteLine("******************");
Console.WriteLine(" KALKULATOR ");
Console.WriteLine("******************");
Console.Write("Bilangan 1=");
b1 = double.Parse(Console.ReadLine());

Console.Write("Bilangan 2=");
b2 = double.Parse(Console.ReadLine());

Console.Write("Operasi=");
opr = Console.ReadLine();

if (opr == "+")
{
result = b1 + b2;
}
else if (opr == "-")
{
result = b1 - b2;
}
else if (opr == "*")
{
result = b1 * b2;
}
else if (opr == "/")
{
result = b1 / b2;
}
else
{
Console.WriteLine("Operator Tidak Terdefinisi");
}

Console.WriteLine();
Console.WriteLine("Hasil =" + result.ToString());

Console.WriteLine("Ingin Mengulang Program? (Y/N) ");


ulang = Console.ReadLine();

Console.ReadKey();
}
}
}

You might also like