write the program for prime numbers?
Answer Posted / vinay tiwari
try this u can find out all prime number between 2 and any
number entered by user .i write code in c# language but
concept remain same in any language.
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication23
{
class Program
{
static void Main(string[] args)
{
int i=2, j, rem;
while (i <= 100)
{
for (j = 2; j < i; j++)
{
rem = i % j;
if (rem == 0)
break;
}
if (i == j)
Console.WriteLine(i);
i++;
}
}
}
}
Is This Answer Correct ? | 250 Yes | 136 No |
Post New Answer View All Answers
What does c value mean?
What are the general description for loop statement and available loop types in c?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
What is the c value paradox and how is it explained?
Under what circumstances does a name clash occur?
Is main is user defined function?
What are types of functions?
Write program to remove duplicate in an array?
What is difference between structure and union in c programming?
What is the use of structure padding in c?
What are different storage class specifiers in c?
What is structure padding and packing in c?
What functions are in conio h?
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
What is meant by high-order and low-order bytes?