stefan1919

Zero Subset

Jul 21st, 2015
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6.  
  7. namespace novo2
  8. {
  9.     class Program
  10.     {
  11.  
  12.         static void Main(string[] args)
  13.         {
  14.             int firstNumber;
  15.             firstNumber = int.Parse(Console.ReadLine());
  16.             int secondNumber;
  17.             secondNumber = int.Parse(Console.ReadLine());
  18.             int thirdNumber;
  19.             thirdNumber = int.Parse(Console.ReadLine());
  20.             int fourthNumber;
  21.             fourthNumber = int.Parse(Console.ReadLine());
  22.             int fifthNumber;
  23.             fifthNumber = int.Parse(Console.ReadLine());
  24.             int a;
  25.             int b;
  26.             int c;
  27.             int d;
  28.             int e;
  29.             a = firstNumber;
  30.             b = secondNumber;
  31.             c = thirdNumber;
  32.             d = fourthNumber;
  33.             e = fifthNumber;
  34.             int def = 0;
  35.  
  36.            
  37.                
  38.                         if (a + b == 0)
  39.                         {
  40.  
  41.                             Console.WriteLine("{0} + {1} = 0", a, b);
  42.                             def = 1;
  43.                         }
  44.                    
  45.                    
  46.                         if (a + b + c == 0)
  47.                         {
  48.                             Console.WriteLine("{0} + {1} + {2} = 0", a, b, c);
  49.                             def = 1;
  50.                         }
  51.                         if (a + c == 0)
  52.                         {
  53.                             Console.WriteLine("{0} + {1} = 0", a, c);
  54.                             def = 1;
  55.                         }
  56.                         if (b + c == 0)
  57.                         {
  58.                             Console.WriteLine("{0} + {1} = 0", b, c);
  59.                             def = 1;
  60.                         }
  61.                    
  62.                    
  63.                         if (a + b + c + d == 0)
  64.                         {
  65.                             Console.WriteLine("{0} + {1} + {2} + {3} = 0", a, b, c, d);
  66.                             def = 1;
  67.                         }
  68.                         if (a + b + d == 0)
  69.                         {
  70.                             Console.WriteLine("{0} + {1} + {2} = 0", a, b, d);
  71.                             def = 1;
  72.                         }
  73.                         if (a + c + d == 0)
  74.                         {
  75.                             Console.WriteLine("{0} + {1} + {2} = 0", a, c, d);
  76.                             def = 1;
  77.                         }
  78.                         if (b + c + d == 0)
  79.                         {
  80.                             Console.WriteLine("{0} + {1} + {2} = 0", b, c, d);
  81.                             def = 1;
  82.                         }
  83.                         if (a + d == 0)
  84.                         {
  85.                             Console.WriteLine("{0} + {1} = 0", a, d);
  86.                             def = 1;
  87.                         }
  88.                         if (b + d == 0)
  89.                         {
  90.                             Console.WriteLine("{0} + {1} = 0", b, d);
  91.                             def = 1;
  92.                         }
  93.                         if (c + d == 0)
  94.                         {
  95.                             Console.WriteLine("{0} + {1} = 0", c, d);
  96.                             def = 1;
  97.                         }
  98.  
  99.  
  100.                         if (a + b + c + d + e == 0)
  101.                         {
  102.                             Console.WriteLine("{0} + {1} + {2} + {3} + {4} = 0", a, b, c, d, e);
  103.                             def = 1;
  104.                         }
  105.                         if (a + e + c + d == 0)
  106.                         {
  107.                             Console.WriteLine("{0} + {1} + {2} + {3} = 0", a, c, d, e);
  108.                             def = 1;
  109.                         }
  110.                         if (e + b + c + d == 0)
  111.                         {
  112.                             Console.WriteLine("{0} + {1} + {2} + {3} = 0", b, c, d, e);
  113.                             def = 1;
  114.                         }
  115.                         if (a + b + e + d == 0)
  116.                         {
  117.                             Console.WriteLine("{0} + {1} + {2} + {3} = 0", a, b, d, e);
  118.                             def = 1;
  119.                         }
  120.                         if (a + b + c + e == 0)
  121.                         {
  122.                             Console.WriteLine("{0} + {1} + {2} + {3} = 0", a, b, c, e);
  123.                             def = 1;
  124.                         }
  125.                         if (a + b + e == 0)
  126.                         {
  127.                             Console.WriteLine("{0} + {1} + {2} = 0", a, b, e);
  128.                             def = 1;
  129.                         }
  130.                         if (a + c + e == 0)
  131.                         {
  132.                             Console.WriteLine("{0} + {1} + {2} = 0", a, c, e);
  133.                             def = 1;
  134.                         }
  135.                         if (a + d + e == 0)
  136.                         {
  137.                             Console.WriteLine("{0} + {1} + {2} = 0", a, d, e);
  138.                             def = 1;
  139.                         }
  140.                         if (c + b + e == 0)
  141.                         {
  142.                             Console.WriteLine("{0} + {1} + {2} = 0", b, c, e);
  143.                             def = 1;
  144.                         }
  145.                         if (d + b + e == 0)
  146.                         {
  147.                             Console.WriteLine("{0} + {1} + {2} = 0", b, d, e);
  148.                             def = 1;
  149.                         }
  150.                         if (c + d + e == 0)
  151.                         {
  152.                             Console.WriteLine("{0} + {1} + {2} = 0", c, d, e);
  153.                             def = 1;
  154.                         }
  155.                         if (a + e == 0)
  156.                         {
  157.                             Console.WriteLine("{0} + {1} = 0", a, e);
  158.                             def = 1;
  159.                         }
  160.                         if (b + e == 0)
  161.                         {
  162.                             Console.WriteLine("{0} + {1} = 0", b, e);
  163.                             def = 1;
  164.                         }
  165.                         if (c + e == 0)
  166.                         {
  167.                             Console.WriteLine("{0} + {1} = 0", c, e);
  168.                             def = 1;
  169.                         }
  170.                         if (d + e == 0)
  171.                         {
  172.                             Console.WriteLine("{0} + {1} = 0", d, e);
  173.                             def = 1;
  174.                         }
  175.                     if ( def == 0)
  176.                     {
  177.                         Console.WriteLine("No zero subset");
  178.                     }
  179.                 }
  180.             }
  181.         }
Advertisement
Add Comment
Please, Sign In to add comment