Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _13._Prime_Pairs
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int firstStartCombination = int.Parse(Console.ReadLine());
- int SecondStartCombination = int.Parse(Console.ReadLine());
- int endFirstLoop = int.Parse(Console.ReadLine());
- int endSecondLoop = int.Parse(Console.ReadLine());
- bool firstLoop = true, secondLoop = true;
- int endFLoop = firstStartCombination + endFirstLoop;
- int endSLoop = SecondStartCombination + endSecondLoop;
- for (int i = firstStartCombination; i <= endFLoop; i++)
- {
- for (int o = SecondStartCombination; o <= endSLoop; o++)
- {
- for (int n = 2; n <= Math.Sqrt(i); n++)
- {
- if (i % n == 0) { firstLoop = false; break; }
- }
- for (int m = 2; m <= Math.Sqrt(o); m++)
- {
- if (o % m == 0) { secondLoop = false; break; }
- }
- if (firstLoop && secondLoop)
- {
- Console.WriteLine($"{i}{o}");
- }
- else { firstLoop = true; secondLoop = true; }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement