Advertisement
callumbinner22

pg 347 Task 2.2

Dec 6th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 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("Please enter your third number");
  18.             int num3 = Convert.ToInt32(Console.ReadLine());
  19.             Console.WriteLine(GetMax(num, num2,num3));
  20.         }
  21.         static int GetMax(int num, int num2, int num3)
  22.         {
  23.             if (num > num2 && num > num3)
  24.             {
  25.                 return num;
  26.             }
  27.             if (num < num2 && num2 > num3)
  28.             {
  29.                 return num2;
  30.             }
  31.             else if (num3 > num && num3> num2)
  32.             {
  33.                 return num3;
  34.             }
  35.            
  36.             return Convert.ToInt32("error");
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement