Write a program in c# (c sharp) to find out the Prime Numbers between series of 1 -50 numbers.
using System;
namespace PrimeNumber
{
class Program
{
static void Main(string[] args)
{
bool prime = true;
Console.WriteLine("Prime Numbers Bet: ");
for (int i = 2; i <= 50; i++)
{
for (int j = 2; j <= 50; j++)
{
if (i != j && i % j == 0)
{
prime = false;
break;
}
}
if (prime)
{
Console.WriteLine(i);
}
prime = true;
}
Console.ReadKey();
}
}
}
If anyone have any doubt about the program , please comment and you can also mail me on "ibsarmschauhan13@gmail.com" and "makansingh42@yahoo.com".
No comments:
Post a Comment