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;
- namespace ConsoleApplication1
- {
- class Program
- {
- static boolean prim(int szam)
- {
- if(szam == 1)
- return false;
- for(int i = 2; i < szam; i++)
- {
- if(szam % i == 0)
- return false;
- }
- return true;
- }
- static void Main(string[] args)
- {
- int[] tomb = new int[100];
- Random r = new Random();
- for (int i = 0; i < 100; i++)
- {
- tomb[i] = r.Next(1, 201);
- }
- foreach (int elem in tomb)
- {
- if(prim(elem))
- Console.WriteLine(elem);
- }
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment