Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class LeastMajorMultiple
- {
- static void Main()
- {
- int a = int.Parse(Console.ReadLine());
- int b = int.Parse(Console.ReadLine());
- int c = int.Parse(Console.ReadLine());
- int d = int.Parse(Console.ReadLine());
- int e = int.Parse(Console.ReadLine());
- for (int leastMajorMlt = 1; true; leastMajorMlt++)
- {
- int numCnt = 0;
- if (leastMajorMlt % a == 0) numCnt++;
- if (leastMajorMlt % b == 0) numCnt++;
- if (leastMajorMlt % c == 0) numCnt++;
- if (leastMajorMlt % d == 0) numCnt++;
- if (leastMajorMlt % e == 0) numCnt++;
- if (numCnt >= 3)
- {
- Console.WriteLine(leastMajorMlt);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment