Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _01.Birthday
- {
- class Program
- {
- static void Main(string[] args)
- {
- int hundreds = int.Parse(Console.ReadLine());
- int tenths = int.Parse(Console.ReadLine());
- int units = int.Parse(Console.ReadLine());
- for (int hundred = 1; hundred <= hundreds; hundred++)
- {
- for (int tent = 1; tent <= tenths; tent++)
- {
- for (int uni = 1; uni <= units; uni++)
- {
- bool isPrime = true;
- if (tent == 1) isPrime = false;
- if (tent % 2 == 0) isPrime = false;
- var boundary = (int)Math.Ceiling(Math.Sqrt(tent));
- for (int i = 3; i <= boundary; i += 2)
- {
- if (tent % i == 0) isPrime = false;
- }
- if (tent == 2) isPrime = true;
- if (hundred % 2 == 0 && uni % 2 == 0 && isPrime)
- {
- Console.WriteLine($"{hundred}{tent}{uni}");
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment