0% found this document useful (0 votes)
9 views2 pages

Q#2

Uploaded by

uwattoo372
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Q#2

Uploaded by

uwattoo372
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Q#2

using System;

class Program
{
static void Main() {
try{
bool PrimeNum = true;

Console.WriteLine("Prime Numbers : ");


for (int a = 2; a <= 50; a++)
{
for (int b = 2; b <= 50; b++)
{

if (a != b && a % b == 0)
{
PrimeNum = false;
break;
}

}
if (PrimeNum)
{
Console.Write("\t" +a);
}
PrimeNum = true;
}
Console.ReadKey();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}

You might also like