Advertisement
silvana1303

smallest of three numbers

May 28th, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Numerics;
  5. using System.Text;
  6.  
  7. namespace exampreparation
  8. {
  9.     class exam
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int input1 = int.Parse(Console.ReadLine());
  14.             int input2 = int.Parse(Console.ReadLine());
  15.             int input3 = int.Parse(Console.ReadLine());
  16.  
  17.             int smallest = Smallest(input1, input2, input3);
  18.             Console.WriteLine(smallest);
  19.         }
  20.  
  21.         static int Smallest(int input1, int input2, int input3)
  22.         {
  23.             int smallest = 0;
  24.  
  25.             if (input1 < input2 && input1 < input3)
  26.             {
  27.                 smallest = input1;
  28.             }
  29.             else if (input2 < input1 && input2 < input3)
  30.             {
  31.                 smallest = input2;
  32.             }
  33.             else
  34.             {
  35.                 smallest = input3;
  36.             }
  37.  
  38.             return smallest;
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement