Skip to content

Instantly share code, notes, and snippets.

@IvanNikolov
Created October 7, 2014 12:53

Revisions

  1. IvanNikolov created this gist Oct 7, 2014.
    17 changes: 17 additions & 0 deletions NumberComparer
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    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);
    }
    }