Advertisement
callumbinner22

pg347 Task2.1

Dec 5th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("Please enter your first number");
  14.             int num = Convert.ToInt32(Console.ReadLine());
  15.             Console.WriteLine("Please Enter your second number");
  16.             int num2 = Convert.ToInt32(Console.ReadLine());
  17.             Console.WriteLine(GetMax(num, num2));
  18.         }
  19.         static int GetMax(int num, int num2)
  20.         {
  21.             if (num > num2)
  22.             {
  23.                 return num;
  24.             }
  25.             else if (num<num2)
  26.             {
  27.                 return num2;
  28.             }
  29.             return Convert.ToInt32("error");
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement