write the program for prime numbers?

Answer Posted / anesh kumar

# include <iostream.h>
# include <conio.h>
int main()
{
int i,j=2,num=0;
cout<<"\n Enter the number";
cin>>i%j>>i;
while(j<=i/2)
{
if(i%j==0)
{
Cout<<"%d Is not prime number"<<i;
ch=1;
break;
}
else
{
j++;
}
}
if(num==0)
{
Cout<<"%d Is prime number"<<i;
}
getch();
return 0;

}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is it that not all header files are declared in every C program?

681


What are the types of functions in c?

570


What is wild pointer in c?

604


There seem to be a few missing operators ..

617


write a c program to calculate sum of digits till it reduces to a single digit using recursion

2718






write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

1981


When we use void main and int main?

588


What is string length in c?

607


What are formal parameters?

656


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

1580


What is uint8 in c?

642


What is f'n in math?

619


Are there constructors in c?

593


"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above

612


explain what are actual arguments?

633