using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int i, n,flag = 0;
Console.Write("Enter a number");
n = int.Parse(Console.ReadLine());
for(i=1;i<=n;i++)
{
if (i % 2 == 0)
flag++;
}
if(flag==2)
Console.Write("The number is Prime");
else
Console.Write("The number is not Prime");
Console.ReadKey();
}
}
}
/*Do leave a comment if you find this useful*/
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int i, n,flag = 0;
Console.Write("Enter a number");
n = int.Parse(Console.ReadLine());
for(i=1;i<=n;i++)
{
if (i % 2 == 0)
flag++;
}
if(flag==2)
Console.Write("The number is Prime");
else
Console.Write("The number is not Prime");
Console.ReadKey();
}
}
}
/*Do leave a comment if you find this useful*/
No comments:
Post a Comment