Open Means Open Means
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();
}
}

No comments

Login to post a comment

Show
  • Create an account
  • Forgot your username?
  • Forgot your password?
  • About Us
  • Faqs
  • Contact Us
  • Disclaimer
  • Terms & Conditions