Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

The Islamia University Of Bahawalpur

Visual programming
Prepared By:

IQRA PERVEEN
FA19M2MA008

Submitted To:

Sir. Hamza rafique


MCs 3rd M.
2019-2021
Assignment 2.
Create Basic Calculator Using C# Console application That is capable of
performing addition, subtraction, multiplication as well as division. User will
enter values and operation and program will calculate Result according to the
given operation

Solution
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace HelloWorld

class Program

static void Main(string[] args)

int x=20;

int y=10;

int s=0;

char op='+';

switch (op)

case '+':

s=x+y;
break;

case '-':

s=x-y;

break;

case '*':

s=x*y;

break;

case '/':

s=x/y;

break;

default:

Console.WriteLine("wrong operator");

break;

Console.WriteLine("result is=" +s);

Console.ReadLine();

You might also like