Advertisement
Asinka

02. LeastMajorityMultiple (TestExam)

Dec 26th, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4.  
  5. class LeastMajorityMultiple
  6. {
  7.     static void Main()
  8.     {
  9.         int a = int.Parse(Console.ReadLine());
  10.         int b = int.Parse(Console.ReadLine());
  11.         int c = int.Parse(Console.ReadLine());
  12.         int d = int.Parse(Console.ReadLine());
  13.         int e = int.Parse(Console.ReadLine());
  14.        
  15.         int i = 1;
  16.  
  17.         for (i = 1; i <= 1000000000; i++)
  18.         {
  19.             int count = 0;
  20.             if (i % a == 0)
  21.             {
  22.                 count++;
  23.             }
  24.             if (i % b == 0)
  25.             {
  26.                 count++;
  27.             }
  28.             if (i % c == 0)
  29.             {
  30.                 count++;
  31.             }
  32.             if (i % d == 0)
  33.             {
  34.                 count++;
  35.             }
  36.             if (i % e == 0)
  37.             {
  38.                 count++;
  39.             }
  40.             if (count > 2)
  41.             {
  42.                 break;
  43.             }
  44.         }
  45.         Console.WriteLine(i);
  46.  
  47.  
  48.  
  49.  
  50.  
  51.        
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement