Advertisement
PerunL

Untitled

Feb 25th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.79 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 Exercise_1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             while(true)
  14.             {
  15.             Console.Write("Število 1: ");
  16.             string a = Console.ReadLine();
  17.             Console.Write("Število 2: ");
  18.             string b = Console.ReadLine();
  19.             Console.Write("Število 3: ");
  20.             string c = Console.ReadLine();
  21.  
  22.             int x = Convert.ToInt32(a);
  23.             int y = Convert.ToInt32(b);
  24.             int z = Convert.ToInt32(c);
  25.             int min = 1;
  26.             int max = 1;
  27.  
  28.             if (x < y && x < z)
  29.             {
  30.                 min = x;
  31.             }
  32.             else if (x > y && x > z)
  33.             {
  34.                 max = x;
  35.             }
  36.             if (y < x && y < z)
  37.             {
  38.                 min = y;
  39.             }
  40.             else if (y > x && y > z)
  41.             {
  42.                 max = y;
  43.             }
  44.             if (z < x && z < y)
  45.             {
  46.                 min = z;
  47.             }
  48.             else if (z > x && z > y)
  49.             {
  50.                 max = z;
  51.             }
  52.             if (x == y || y == z)
  53.             {
  54.                 min = x;
  55.                 max = z;
  56.             }
  57.             if (x == y || x == z)
  58.             {
  59.                 min = x;
  60.                 max = y;
  61.             }
  62.             else if (x == y && y ==z)
  63.             {
  64.                 min = x;
  65.                 max = y;
  66.             }
  67.  
  68.             int prod = min * max;
  69.             Console.WriteLine();
  70.             Console.WriteLine("Zmnožek števil je " + prod.ToString());
  71.             Console.WriteLine();
  72.             }
  73.         }
  74.     }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement