using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
 class Program
 {
     static void Main(string[] args)
     {
         int  num ,count;
         bool stat=false;
         Console.WriteLine("Enter the number");
         num = Convert.ToInt32(Console.ReadLine());
     
         for (int i = 1; i <= num; i++)
         {              
count = 0;                              
for (int j = 1; j <= i; j++)              
{
if ((i % j) == 0)
stat = true;
if (stat)
{
count++;                      
stat = false;                  
}
}
if(count==2)                           
Console.WriteLine(i);
}
Console.ReadLine();
}
}
}  
 
No comments:
Post a Comment