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 || operator and how does it function in a program?
What is the main difference between calloc () and malloc ()?
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
What is the difference between c &c++?
What is the difference between procedural and functional programming?
Tell me what are bitwise shift operators?
Explain how are 16- and 32-bit numbers stored?
Explain what is #line used for?
Write the syntax and purpose of a switch statement in C.
Explain how can I manipulate strings of multibyte characters?
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
Explain how do you sort filenames in a directory?
What is the difference between array and pointer?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()