Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             //int x;
  14.             //x = 2;
  15.             //do
  16.             //{
  17.             //    Console.WriteLine(x);
  18.             //    x = x * 2;
  19.             //    System.Threading.Thread.Sleep(500);
  20.             //} while (x < 50);
  21.  
  22.  
  23.             //Console.ReadKey();
  24.             //}
  25.  
  26.          
  27.  
  28.            
  29.                 for (int x = 2; x < 100; x++)
  30.                 {
  31.                     int isPrime = 0;
  32.  
  33.                     for (int y = 1; y < x; y++)
  34.                     {
  35.                         if (x % y == 0)
  36.                             isPrime++;
  37.  
  38.                         if (isPrime == 2) break;
  39.                     }
  40.                     if (isPrime != 2)
  41.                         Console.WriteLine(x);
  42.  
  43.                     isPrime = 0;
  44.                 }
  45.                 Console.ReadKey();
  46.             }
  47.  
  48.  
  49.        
  50.     }
  51.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement