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 is pointer and structure in c?
Is that possible to store 32768 in an int data type variable?
How do you write a program which produces its own source code as output?
What is page thrashing?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
Do you know pointer in c?
Where is c used?
Which node is more powerful and can handle local information processing or graphics processing?
Why do we need arrays in c?
What is identifiers in c with examples?
What is the difference between procedural and declarative language?
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
What is union and structure?
What extern c means?