100% found this document useful (1 vote)
394 views3 pages

Visual Programming: The Islamia University of Bahawalpur

The document is an assignment submitted by Iqra Perveen to Sir. Hamza Rafique for their MCs 3rd M class. The assignment asks to create a basic calculator using C# console application that can perform addition, subtraction, multiplication, and division based on user input values and operation. The solution provided uses a switch statement to evaluate the operator and perform the calculation, outputting the result.

Uploaded by

Iقrä
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
394 views3 pages

Visual Programming: The Islamia University of Bahawalpur

The document is an assignment submitted by Iqra Perveen to Sir. Hamza Rafique for their MCs 3rd M class. The assignment asks to create a basic calculator using C# console application that can perform addition, subtraction, multiplication, and division based on user input values and operation. The solution provided uses a switch statement to evaluate the operator and perform the calculation, outputting the result.

Uploaded by

Iقrä
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy