Advertisement
MARINA_GREBENAROVA

SmallestofThreeNumbers

Aug 22nd, 2022
732
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2.  
  3. namespace SmallestofThreeNumbersMine
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             int first = int.Parse(Console.ReadLine());
  11.             int second = int.Parse(Console.ReadLine());
  12.             int third = int.Parse(Console.ReadLine());
  13.             Console.WriteLine(GetMin(first, second, third));
  14.  
  15.         }
  16.  
  17.         static int GetMin(int first, int second, int third)
  18.         {
  19.             if (first < second && first < third)
  20.             {
  21.                 return first;
  22.             }
  23.             else if (second < first && second < third)
  24.             {
  25.                 return second;
  26.             }
  27.             else
  28.             {
  29.                 return third;
  30.             }
  31.         }
  32.     }
  33. }
  34.  
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement