Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _13.PrimePairs
- {
- class Program
- {
- static void Main(string[] args)
- {
- int startFirstCouple = int.Parse(Console.ReadLine());
- int startSecondCouple = int.Parse(Console.ReadLine());
- int diffFirstCouple = int.Parse(Console.ReadLine());
- int diffSecondCouple = int.Parse(Console.ReadLine());
- int endFirstCouple = startFirstCouple+diffFirstCouple;
- int endSecondCouple = startSecondCouple+diffSecondCouple;
- for (int i = startFirstCouple; i <=endFirstCouple; i++)
- {
- for (int j = startSecondCouple; j <=endSecondCouple; j++)
- {
- bool primeFirst = true;
- for (int primeNumFirst = 2; primeNumFirst <= i/2; primeNumFirst++)
- {
- if (i % primeNumFirst == 0)
- {
- primeFirst = false;
- }
- }
- bool primeSecond = true;
- for (int primeNumSecond = 2; primeNumSecond <= j/2; primeNumSecond++)
- {
- if (j % primeNumSecond == 0)
- {
- primeSecond = false;
- }
- }
- if (primeFirst && primeSecond)
- {
- Console.WriteLine($"{i}{j}");
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement