Advertisement
Spaskich

Untitled

Sep 21st, 2015
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class BiggerNumber
  5. {
  6.     static void Main()
  7.     {
  8.         Console.WriteLine("Enter two numbers, separated by a space.");
  9.         int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  10.         int firstNum = input[0];
  11.         int secondNUm = input[1];
  12.  
  13.         int max = GetMax(firstNum, secondNUm);
  14.         Console.WriteLine("The bigger number is: {0}", max);
  15.         Console.WriteLine("If the numbers are equal, the program prints the left one.");
  16.     }
  17.  
  18.     static int GetMax (int a, int b)
  19.     {
  20.         if (a >= b)
  21.         {
  22.             return a;
  23.         }
  24.         else
  25.         {
  26.             return b;
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement