PROGRAM TO DEVELOP A CALCULATOR IN C-SHARP - Selamat datang di situs media global terbaru Xivanki, Pada halaman ini kami menyajikan informasi tentang PROGRAM TO DEVELOP A CALCULATOR IN C-SHARP !! Semoga tulisan dengan kategori ini bermanfaat bagi anda. Silahkan sebarluaskan postingan PROGRAM TO DEVELOP A CALCULATOR IN C-SHARP ini ke social media anda, Semoga rezeki berlimpah ikut dimudahkan Allah bagi anda, Lebih jelas infonya lansung dibawah -->
PROGRAM TO DEVELOP A CALCULATOR IN C-SHARP BY USING CLASS
BEGIN
using System;
class test
{
public void add()
{
Console.WriteLine("enter 2 number");
int n1 = int.Parse(Console.ReadLine());
int n2 = int.Parse(Console.ReadLine());
Console.WriteLine(n1+n2);
}
public void sub()
{
Console.WriteLine("enter 2 number");
int n1 = int.Parse(Console.ReadLine());
int n2 = int.Parse(Console.ReadLine());
Console.WriteLine(n1 - n2);
}
public void mul()
{
Console.WriteLine("enter 2 number");
int n1 = int.Parse(Console.ReadLine());
int n2 = int.Parse(Console.ReadLine());
Console.WriteLine(n1 * n2);
}
public void div()
{
Console.WriteLine("enter 2 number");
int n1 = int.Parse(Console.ReadLine());
int n2 = int.Parse(Console.ReadLine());
Console.WriteLine(n1 / n2);
}
public static void Main()
{
Console.WriteLine("1-add 2-sub 3-multiply 4-divide");
int choice = int.Parse(Console.ReadLine());
if (choice == 1)
{
test obj = new test();
obj.add();
}
else if (choice == 2)
{
test obj = new test();
obj.sub();
}
else if (choice == 3)
{
test obj = new test();
obj.mul();
}
else if (choice == 4)
{
test obj = new test();
obj.div();
}
}
}
END
BEGIN
using System;
class test
{
public void add()
{
Console.WriteLine("enter 2 number");
int n1 = int.Parse(Console.ReadLine());
int n2 = int.Parse(Console.ReadLine());
Console.WriteLine(n1+n2);
}
public void sub()
{
Console.WriteLine("enter 2 number");
int n1 = int.Parse(Console.ReadLine());
int n2 = int.Parse(Console.ReadLine());
Console.WriteLine(n1 - n2);
}
public void mul()
{
Console.WriteLine("enter 2 number");
int n1 = int.Parse(Console.ReadLine());
int n2 = int.Parse(Console.ReadLine());
Console.WriteLine(n1 * n2);
}
public void div()
{
Console.WriteLine("enter 2 number");
int n1 = int.Parse(Console.ReadLine());
int n2 = int.Parse(Console.ReadLine());
Console.WriteLine(n1 / n2);
}
public static void Main()
{
Console.WriteLine("1-add 2-sub 3-multiply 4-divide");
int choice = int.Parse(Console.ReadLine());
if (choice == 1)
{
test obj = new test();
obj.add();
}
else if (choice == 2)
{
test obj = new test();
obj.sub();
}
else if (choice == 3)
{
test obj = new test();
obj.mul();
}
else if (choice == 4)
{
test obj = new test();
obj.div();
}
}
}
END
Demikian info PROGRAM TO DEVELOP A CALCULATOR IN C-SHARP , Semoga dengan adanya postingan ini, Anda sudah benar benar menemukan informasi yang memang sedang anda butuhkan saat ini. Bagikan informasi PROGRAM TO DEVELOP A CALCULATOR IN C-SHARP ini untuk orang orang terdekat anda, Bagikan infonya melalui fasilitas layanan Share Facebook maupun Twitter yang tersedia di situs ini.