simple calculator using c# all arithmetic and logical operators.
simple calculator using c#
code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace simple_calculator
{
class Program
{
static void Main(string[] args)
{
DateTime dt = DateTime.Now;
Console.WriteLine("{0}",dt);
Console.WriteLine("======Simple calculator======");
int num1, num2;
Console.WriteLine("Enter first number:");
num1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter second number:");
num2 = Convert.ToInt32(Console.ReadLine());
double add = num1 + num2;
Console.WriteLine("Addition:{0:0.00}", add);
double sub = num1 - num2;
Console.WriteLine("Substraction:{0:#.###}", sub);
double mul = num1 * num2;
Console.WriteLine("Multilication:{0:#.###}", mul);
double div = num1 / num2;
Console.WriteLine("Division:{0:#.###}", div);
Console.WriteLine("Increment:{0}",++num1);
Console.WriteLine("bitwise AND:{0}",num1&num2);
Console.WriteLine("bitwise OR:{0}", num1 | num2);
Console.WriteLine("bitwise NOT:{0}", num1 ^ num2);
Console.ReadLine();
}
}
}
output:
Comments
Post a Comment