Skip to content

Instantly share code, notes, and snippets.

@IvanNikolov
Created October 7, 2014 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IvanNikolov/dd33dfd5a9772f431f31 to your computer and use it in GitHub Desktop.
Save IvanNikolov/dd33dfd5a9772f431f31 to your computer and use it in GitHub Desktop.
using System;
//Write a program that gets two numbers from the console and prints the greater of them. Try to implement this without if statements. Examples:
//a b greater
//5 6 6
//10 5 10
class NumberComparer
{
static void Main()
{
double a = double.Parse(Console.ReadLine());
double b = double.Parse(Console.ReadLine());
bool greater = (a > b);
Console.WriteLine(greater? a : b);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment