Advertisement
skipter

C# 3 int / Method for 2 -> Smaller of 3

Jun 16th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2. namespace Arrays_Exercise
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             int a = int.Parse(Console.ReadLine());
  9.             int b = int.Parse(Console.ReadLine());
  10.             int c = int.Parse(Console.ReadLine());            
  11.             int minNumber = GetMin(a, b);
  12.             int smallerFinal = GetMin(minNumber, c);
  13.             Console.WriteLine(smallerFinal);            
  14.         }
  15.         private static int GetMin(int a, int b)
  16.         {
  17.             if (a < b)
  18.             {
  19.                 return a;
  20.             } else
  21.             {
  22.                 return b;
  23.             }            
  24.         }        
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement