Created
October 15, 2014 11:53
-
-
Save IvanNikolov/c2d689d80e2d5208613a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
//Write a program that finds the biggest of five numbers | |
//by using only five if statements. | |
class BiggestOf5Numbers | |
{ | |
static void Main() | |
{ | |
double a = double.Parse(Console.ReadLine()); | |
double b = double.Parse(Console.ReadLine()); | |
double c = double.Parse(Console.ReadLine()); | |
double d = double.Parse(Console.ReadLine()); | |
double e = double.Parse(Console.ReadLine()); | |
if ((a>b && a>c) && (a>d && a>e)) //checks a | |
{ | |
Console.WriteLine(a); | |
} | |
if ((b>a && b>c) && (b>d && b>e)) //checks b | |
{ | |
Console.WriteLine(b); | |
} | |
if ((c>a && c>b) && (c>d && c>e)) //checks c | |
{ | |
Console.WriteLine(c); | |
} | |
if ((d>a && d>b) && (d>c && d>=e)) //checks c | |
{ | |
Console.WriteLine(d); | |
} | |
if ((e>a && e>b) && (e>c && e>d)) //checks e | |
{ | |
Console.WriteLine(e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment