Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manickam PalanigounderRank #1,732 · 873 reputationPosted Nov 17, 2022, 5:42 PM EST
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();
Jignesh KumarRank #91 · 22.9K reputationPosted Nov 17, 2022, 10:56 PM EST
Hello Naresh,
Please refer this article which has few frequently asked coding interview question.
https://www.c-sharpcorner.com/article/net-programing-interview-questions/
Amit MohantyRank #112 · 20K reputationPosted Nov 17, 2022, 11:18 PM EST
If you google it you can find many links. Please first try it by yourself.
Vishal YelveRank #178 · 13.6K reputationPosted Nov 18, 2022, 1:35 AM EST
using System; namespace LogicalPrograms { public class Program { static void Main(string[] args) { Console.Write("Enter The Start Number: "); int startNumber = int.Parse(Console.ReadLine()); Console.Write("Enter the End Number : "); int endNumber = Convert.ToInt32(Console.ReadLine()); Console.WriteLine($"The Prime Numbers between {startNumber} and {endNumber} are : "); for (int i = startNumber; i <= endNumber; i++) { int counter = 0; for (int j = 2; j <= i / 2; j++) { if (i % j == 0) { counter++; break; } } if (counter == 0 && i != 1) { Console.Write("{0} ", i); } } Console.ReadKey(); } } }Rajesh GamiRank #30 · 41.5K reputationPosted Nov 18, 2022, 6:34 AM EST
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