Вы находитесь на странице: 1из 4

while (true)

{
float num1;
float num2;
float num3;
string ans;
const string name = "Leonard Jason S. Parfan";

Console.WriteLine("\n\n{0,51}",name);
Console.WriteLine("_____________________________________________
___________________________________");
Console.Write("\tEnter 1st Number: ");
num1 = float.Parse(Console.ReadLine());

Console.Write("\t 2nd Number: ");
num2 = float.Parse(Console.ReadLine());
Console.Write("\t 3rd Number: ");
num3 = float.Parse(Console.ReadLine());

Console.WriteLine("{0,76}", "-----------------------------------
--------------------------------------");
if ((num1 > num2) && (num1 > num3))
{
Console.WriteLine("\tThe highest number is: \t\t\t\t {0:N}"
, num1);
}
else if ((num2 > num1) && (num2 > num3))
{
Console.WriteLine("\tThe highest number is: \t\t\t\t {0:N}"
, num2);
}
else if ((num3 > num1) && (num3 > num2))
{
Console.WriteLine("\tThe highest number is: \t\t\t\t {0:N}"
, num3);
}
else if (num1 == num2 && num2 == num3)
{
Console.WriteLine("\t {0:N}, {1:N}, and {2:N}, are both the
same", num1, num2, num3);
}
else if (num1 == num2)
{
Console.WriteLine("\t {0:N}, and {1:N} are both the same", n
um1, num2);
}
else if (num1 == num3)
{
Console.WriteLine("\t {0:N}, and {1:N} are both the same", n
um1, num3);
}
else if (num2 == num3)
{
Console.WriteLine("\t {0:N}, and {1:N} are both the same", n
um1, num3);
}
Console.WriteLine(" ");
if ((num1 < num2) && (num1 < num3))
{
Console.WriteLine("\tThe lowest number is: \t\t\t\t\t {0:N}
", num1);
}
else if ((num2 < num1) && (num2 < num3))
{
Console.WriteLine("\tThe lowest number is: \t\t\t\t\t {0:N}
", num2);
}
else if ((num3 < num1) && (num3 < num2))
{
Console.WriteLine("\tThe lowest number is: \t\t\t\t\t {0:N}
", num3);
}
else if (num1 == num2 && num2 == num3)
{
Console.WriteLine("\t {0:N}, {1:N}, and {2:N}, are both the
same", num1, num2, num3);
}
else if (num1 == num2)
{
Console.WriteLine("\t {0:N}, and {1:N} are both the same", n
um1, num2);
}
else if (num1 == num3)
{
Console.WriteLine("\t {0:N}, and {1:N} are both the same", n
um1, num3);
}
else if (num2 == num3)
{
Console.WriteLine("\t {0:N}, and {1:N} are both the same", n
um1, num3);
}
Console.WriteLine(" ");
if ((num1 > num2) && (num1 > num3))
{
Console.WriteLine("\tThe Square root of {0:N} is: \t\t\t\t
{1:N}", num1, Math.Sqrt(num1));
}
else if ((num2 > num1) && (num2 > num3))
{
Console.WriteLine("\tThe Square root of {0:N} is: \t\t\t\t
{1:N}", num2, Math.Sqrt(num2));
}
else if ((num3 > num1) && (num3 > num2))
{
Console.WriteLine("\tThe Square root of {0:N} is: \t\t\t\t
{1:N}", num3, Math.Sqrt(num3));
}
else if (num1 == num2 && num2 == num3)
{
Console.WriteLine("\t Since, {0:N}, {1:N}, and {2:N}, are bo
th the same, The Square root is: {3:N} ", num1, num2, num3, Math.Sqrt(num1));
}
else if (num1 == num2)
{
Console.WriteLine("\t Since, {0:N}, and {1:N} are both the s
ame, The Square root is: {2:N}", num1, num2, Math.Sqrt(num1));
}
else if (num1 == num3)
{
Console.WriteLine("\t Since, {0:N}, and {1:N} are both the s
ame, The Square root is: {2:N}", num1, num3, Math.Sqrt(num3));
}
else if (num2 == num3)
{
Console.WriteLine("\t Since, {0:N}, and {1:N} are both the s
ame, The Square root is: {2:N}", num1, num3, Math.Sqrt(num2));
}
Console.WriteLine(" ");
if ((num1 < num2) && (num1 < num3))
{
Console.WriteLine("\tThe Square root of {0:N} is: \t\t\t\t
{1:N}", num1, Math.Sqrt(num1));
}
else if ((num2 < num1) && (num2 < num3))
{
Console.WriteLine("\tThe Square root of {0:N} is: \t\t\t\t
{1:N}", num2, Math.Sqrt(num2));
}
else if ((num3 < num1) && (num3 < num2))
{
Console.WriteLine("\tThe Square root of {0:N} is: \t\t\t\t
{1:N}", num3, Math.Sqrt(num3));
}
else if (num1 == num2 && num2 == num3)
{
Console.WriteLine("\t Since, {0:N}, {1:N}, and {2:N}, are bo
th the same, The Square root is: {3:N} ", num1, num2, num3, Math.Sqrt(num1));
}
else if (num1 == num2)
{
Console.WriteLine("\t Since, {0}, and {1} are both the same,
The Square root is: {2:N}", num1, num2, Math.Sqrt(num1));
}
else if (num1 == num3)
{
Console.WriteLine("\t Since, {0}, and {1} are both the same,
The Square root is: {2:N}", num1, num3, Math.Sqrt(num3));
}
else if (num2 == num3)
{
Console.WriteLine("\t Since, {0}, and {1} are both the same,
The Square root is: {2:N}", num1, num3, Math.Sqrt(num2));
}
Console.Write("\n\n{0,57}", "Do you want to continue? [Y/N]: "
);
ans = Console.ReadLine();
if (ans == "Y" || ans == "y")
{
Console.Clear();
continue;
}
else if (ans == "N" || ans == "n")
{
Console.Clear();
Console.WriteLine("\n\n\n\n{0,63}","Now exiting the program.
Press any key to exit");
break;
}
else
Console.Clear();
Console.WriteLine("\n\n\n\n{0,80}", "You have entered an inv
alid key. Program is now exiting . Press any key to exit");
break;

}


Console.ReadKey();

Вам также может понравиться