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

Simple C# Calculator Program

This document contains code for a C# console application that performs basic arithmetic operations. The application prompts the user to enter two numbers and an operator, performs the calculation based on the operator using a switch statement, and displays the result. It handles addition, subtraction, multiplication, division, and invalid operators.

Uploaded by

JhosepCayao
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
0% found this document useful (0 votes)
6 views1 page

Simple C# Calculator Program

This document contains code for a C# console application that performs basic arithmetic operations. The application prompts the user to enter two numbers and an operator, performs the calculation based on the operator using a switch statement, and displays the result. It handles addition, subtraction, multiplication, division, and invalid operators.

Uploaded by

JhosepCayao
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

using

using
using
using

System;
[Link];
[Link];
[Link];

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
double n1, n2, resul = 0;
char op;
[Link]("ingrese el primer numero:");
n1 = Convert.ToInt32([Link]());
[Link]("ingrese segundo numero:");
n2 = Convert.ToInt32([Link]());
[Link]("ingrese operador");
op = [Link]([Link]());
switch (op)
{ case '+': resul = n1 + n2;
break;
case'-': resul = n1 - n2;
break;
case '*': resul = n1*n2;
break;
case '/': resul= n1/n2;
break;
default:
[Link]("operador no valido");
break;
}
[Link]("resultado:" + resul);
[Link]();
}
}

You might also like