♫ KALKULATOR…
using System;
namespace kalkulator_011
{
class Class1
{
static void Main(string[ ] args)
{
string b;
double a,c,d,e;
Console.Write("Angka 1 :");
a=Convert.ToInt32(Console.ReadLine());
Console.Write("Operator(+,-,*,/) :");
b=Convert.ToString(Console.ReadLine());
Console.Write("Angka 2 :");
c=Convert.ToInt32(Console.ReadLine());
if(b=="*")
{
d=a*c;
Console.WriteLine("{0}",d);
}
else
{
if(b=="/")
{
e=a/c;
Console.WriteLine("{0}",e);
}
else
{
if(b=="+")
{
d=a+c;
Console.WriteLine("{0}",d);
}
else
{
if(b=="-")
{
d=a-c;
Console.WriteLine("{0}",d);
}
else
{
Console.WriteLine("kode salah...");
}
}
}
}
Console.ReadLine();
}
}
}
Tidak ada komentar:
Posting Komentar