I want the user to enter 3 separate integers and for the program to spit back which numbers are equal to each other of if they are not equal to each other. For my code here, I can get it to say they all equal to each other, and the first two are equal, but not for the first and third. I am assuming it's because my else statement isn't placed in the braces correctly.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
namespace Compare3Numbers
{
class Program
{
static void Main(string[] args)
{
int number1;
int number2;
int number3;
Write("Enter the first number: ");
number1 = int.Parse(ReadLine());
Write("Enter the second number: ");
number2 = int.Parse(ReadLine());
Write("Enter the third number: ");
number3 = int.Parse(ReadLine());
if (number1 == number2 && number2 == number3)
{
if (number2 == number3)
{
WriteLine("All your numbers are equal!");
}
else if (number1 == number2)
{
WriteLine("Your first two numbers are equal!");
}
else if (number1 == number3)
{
WriteLine("Your first number and third number are equal!");
}
else if (number2 == number3)
{
WriteLine("Your second number is equal to your third number!");
}
}
//debug line
WriteLine("Press any key to continue...");
ReadLine();
}
}
}