Facebook
From Khanbala Rashidov, 3 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 60
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Test222
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             List<int> list = new List<int>();
  14.             int saygac2 = 0;
  15.             Console.WriteLine("Enter the number...\n");
  16.             int number = int.Parse(Console.ReadLine());
  17.             for (int i = 2; i < number; i++)
  18.             {
  19.                 bool check = true;
  20.              
  21.  
  22.                 for (int j = 2; j < i/2; j++)
  23.                 {
  24.  
  25.                     if (i % j == 0)
  26.                     {
  27.                         check = false;
  28.                         break;
  29.                     }
  30.                 }
  31.                 if (check)
  32.                 {
  33.                     list.Add(i);
  34.                     Console.WriteLine(i);
  35.                     saygac2++;
  36.                 }
  37.             }
  38.             Console.WriteLine($"1st={list[0]} 2st={list[1]}  101st={list[100]}  1001st={list[1000]} 10001st={list[10000]}\n");
  39.             Console.WriteLine("Say="+saygac2);
  40.  
  41.  
  42.  
  43.             Console.ReadLine();
  44.  
  45.  
  46.         }
  47.     }
  48. }
  49.