Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace Application
  5. {
  6.     class MainClass
  7.     {
  8.         public static void Main(string[] args)
  9.         {
  10.             int n1 = int.Parse(Console.ReadLine());
  11.             int m1 = int.Parse(Console.ReadLine());
  12.             int n2 = n1 + int.Parse(Console.ReadLine());
  13.             int m2 = m1 + int.Parse(Console.ReadLine());
  14.  
  15.        
  16.             List<int> nPrime = new List<int>();
  17.             List<int> mPrime = new List<int>();
  18.  
  19.             for (int i = n1; i <= n2; i++) {
  20.                 if (i % 2 != 0 && i % 3 != 0 && i % 5 != 0) {
  21.                     nPrime.Add(i);
  22.                 }
  23.             }
  24.  
  25.             for (int i = m1; i <= m2; i++)
  26.             {
  27.                 if (i % 2 != 0 && i % 3 != 0 && i % 5 != 0)
  28.                 {
  29.                     mPrime.Add(i);
  30.                 }
  31.             }
  32.  
  33.             for (int i = 0; i < nPrime.Count; i++) {
  34.                 for (int j = 0; j < mPrime.Count; j++) {
  35.                     Console.WriteLine("{0}{1}", nPrime[i], mPrime[j]);
  36.                 }
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement