Advertisement
optybg

Untitled

Nov 26th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 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 _9gag
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             //http://9gag.com/gag/aVDbqxK
  14.             //result: 3,50 4,50 9,50 3,50
  15.  
  16.             decimal a = 0.0m;
  17.             decimal b = 0.0m;
  18.             decimal c = 0.0m;
  19.             decimal d = 0.0m;
  20.  
  21.             for (a = 1.0m; a < 8.0m; a= a+0.1m)
  22.             {
  23.                 for (b = 1.0m; b < 8.0m; b = b+0.1m)
  24.                 {
  25.                     for (c = 1.0m; c < 10.0m; c = c+0.1m)
  26.                     {
  27.                       for (d = 1.0m; d <10.0m; d = d+0.1m)
  28.                         {
  29.                            
  30.                            if ( (a+b) == 8.0m && (a+c) ==13.0m && (b+d) == 8.0m && (c - d) == 6.0m)
  31.                             {
  32.                                     Console.WriteLine($"{a:f2} {b:f2} {c:f2} {d:f2}");
  33.                                     break;
  34.                             }
  35.                                                  
  36.                         }
  37.                     }
  38.                 }
  39.             }
  40.  
  41.         }
  42.     }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement