You are on page 1of 2

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp2
{
class Program
{
public static object Private { get; private set; }

static void Main(string[] args)

{
int a; //valor de a
int b; //valor de b
int c; //valor de c

Console.WriteLine("Ingresa el primer valor:");


a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("");

Console.WriteLine("Ingresa el segundo valor:");


b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("");

Console.WriteLine("Ingresa el tercer valor:");


c = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("");

Console.WriteLine("Seleccione una opcion:");


Console.WriteLine("");
Console.WriteLine("1. Validar suma.");
Console.WriteLine("2. Salir.");
Console.WriteLine("");

int opcion;
opcion = Console.ReadKey().KeyChar; // 1 o 2
Console.WriteLine("");
Console.WriteLine("");

switch (opcion)
{
case '1':
{
Console.Out.WriteLine("Haz seleccionado la opcion '1'
validar suma.");
if (a + b == c)

{
Console.WriteLine("");
Console.WriteLine("SON IGUALES");
}
else
if(a + c == b)
{
Console.WriteLine("");
Console.WriteLine("SON IGUALES");
}
else
if(b + c == a)
{
Console.WriteLine("");
Console.WriteLine("SON IGUALES");
}
else
{
Console.WriteLine("SON DIFERENTES");
}

break;
}

case '2':
{
Console.Out.WriteLine("Haz seleccionado la opcion '2'
salir.");
Console.WriteLine("");
Console.WriteLine("ADIOS");
break;
}

default:
{
Console.Out.WriteLine("Seleccionaste una opcion no
valida.");
break;
}

Console.Read();

You might also like