using System;
class calculator
{
int a=0, b;
char option, d='y';
void insert()
{

while (d=='y')
{
option=Convert.ToChar(Console.ReadLine());

switch(option)
{
case '+':
b=Convert.ToInt32(Console.ReadLine());
a=a+b;
Console.WriteLine("Result of Addition : "+a);
break;

case '-':
b=Convert.ToInt32(Console.ReadLine());
a=a-b;
Console.WriteLine("Result of Addition : "+a);
break;

case '*':
b=Convert.ToInt32(Console.ReadLine());
a=a*b;
Console.WriteLine("Result of Addition : "+a);
break;

case '/':
b=Convert.ToInt32(Console.ReadLine());
a=a/b;
Console.WriteLine("Result of Addition : "+a);
break;
default:
Console.WriteLine("invalid value");
d='n';
break;
}   
}
}
public static void Main (string[] a)
{
calculator cal=new calculator();
cal.insert();
}
}

Like it on Facebook, Tweet it or share this article on other bookmarking websites.

No comments