0% found this document useful (0 votes)
3 views1 page

Basic Calculator with Switch Case

This C# program prompts the user to input two numbers and an operator, then performs the corresponding arithmetic operation based on the operator provided. It supports addition, subtraction, multiplication, division, modulus, and calculating the average. If an invalid operator is entered, it outputs an error message.

Uploaded by

Angel Limbo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Basic Calculator with Switch Case

This C# program prompts the user to input two numbers and an operator, then performs the corresponding arithmetic operation based on the operator provided. It supports addition, subtraction, multiplication, division, modulus, and calculating the average. If an invalid operator is entered, it outputs an error message.

Uploaded by

Angel Limbo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

using System;

namespace switch_case_limbo
{
class Program
{
static void Main(string[] args)
{
[Link]("Enter the first number: ");
int first_limbo = [Link]([Link]());
[Link]("Enter the second number: ");
int second_limbo = [Link]([Link]());
[Link]("Enter the operator: ");
string operator_limbo = [Link]();
switch (operator_limbo)
{
case "+":
int sum_limbo = first_limbo + second_limbo;
[Link]("THE SUM IS " + sum_limbo);
break;
case "-":
int diff_limbo = first_limbo - second_limbo;
[Link]("THE DIFFERENCE IS " + diff_limbo);
break;
case "*":
int product_limbo = first_limbo * second_limbo;
[Link]("THE PRODUCT IS " + product_limbo);
break;
case "/":
int qoutient_limbo = first_limbo / second_limbo;
[Link]("THE QOUTIENT IS " + qoutient_limbo);
break;
case "%":
int remainder_limbo = first_limbo % second_limbo;
[Link]("THE REMAINDER IS" + remainder_limbo);
break;
case "AVE":
int ave_limbo = (first_limbo + second_limbo) / 2;
[Link]("THE AVERAGE IS " + ave_limbo);
break;
default:
[Link]("INVALID OPERATOR");
break;
}
}
}
}

You might also like