Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace Application
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- int n1 = int.Parse(Console.ReadLine());
- int m1 = int.Parse(Console.ReadLine());
- int n2 = n1 + int.Parse(Console.ReadLine());
- int m2 = m1 + int.Parse(Console.ReadLine());
- List<int> nPrime = new List<int>();
- List<int> mPrime = new List<int>();
- for (int i = n1; i <= n2; i++) {
- if (i % 2 != 0 && i % 3 != 0 && i % 5 != 0) {
- nPrime.Add(i);
- }
- }
- for (int i = m1; i <= m2; i++)
- {
- if (i % 2 != 0 && i % 3 != 0 && i % 5 != 0)
- {
- mPrime.Add(i);
- }
- }
- for (int i = 0; i < nPrime.Count; i++) {
- for (int j = 0; j < mPrime.Count; j++) {
- Console.WriteLine("{0}{1}", nPrime[i], mPrime[j]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement