Write a program to print prime number 1 to 100 in C#
Loading
Write a program to print prime number 1 to 100 in C#
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajesh GamiPosted Nov 18, 2022, 11:34 AM
I am sure you know answer already, Don't know why are you asking here or you can google it also it's better way
Vishal YelvePosted Nov 18, 2022, 6:35 AM
Amit MohantyPosted Nov 18, 2022, 4:18 AM
If you google it you can find many links. Please first try it by yourself.
Jignesh KumarPosted Nov 18, 2022, 3:56 AM
Hello Naresh,
Please refer this article which has few frequently asked coding interview question.
https://www.c-sharpcorner.com/article/net-programing-interview-questions/
Manickam PalanigounderPosted Nov 17, 2022, 10:42 PM
foreach (int x in Enumerable.Range(2,99))
{
int isPrime = 0;
for (int y = 1; y < x; y++)
{
if (x % y == 0)
isPrime++;
if (isPrime == 2) break;
}
if (isPrime != 2)
Console.WriteLine(x + " ");
}
Console.ReadKey();