Advertisement
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 Ukol01
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Vrchní hranice: ");
- int max = int.Parse(Console.ReadLine());
- Console.Write("Počet prvočísel: ");
- int number = int.Parse(Console.ReadLine()), found=0;
- for(int i = max; found < number && i > 1; i--)
- {
- bool prime = true;
- for(int q = i / 2; q > 1; q--)
- {
- if (i % q == 0) prime = false;
- }
- if (prime)
- {
- Console.WriteLine(i);
- found++;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement