kindly if any one help me to create a calculator which is consaole based yet simple..
Regardz all...
Waitin for ur kind help..

Try this code.

using System;

public class Calculator
{
public static void Main()
{
int num1;
int num2;
string operand;
float answer;


Console.Write("Please enter the first integer: ");
num1 = Convert.ToInt32(Console.ReadLine());


Console.Write("Please enter an operand (+, -, /, *): ");
operand = Console.ReadLine();


Console.Write("Please enter the second integer: ");
num2 = Convert.ToInt32(Console.ReadLine());

switch (operand)
{
case "-":
answer = num1 - num2;
break;
case "+":
answer = num1 + num2;
break;
case "/":
answer = num1 / num2;
break;
case "*":
answer = num1 * num2;
break;
default:
answer = 0;
break;
}

Console.WriteLine(num1.ToString() + " " + operand + " " + num2.ToString() + " = " + answer.ToString());

Console.ReadLine();

}
}

Reference: http://www.devpapers.com/article/288

Also refer this link: Console calculator Part 1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.