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
how can f be used for both float and double arguments in printf? Are not they different types?
If fflush wont work, what can I use to flush input?
Why are algorithms important in c program?
What are the rules for the identifier?
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
What kind of structure is a house?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
using only #include
What are the 5 types of inheritance in c ++?
What is a pointer in c plus plus?
Explain the use of keyword 'register' with respect to variables.
How can I get the current date or time of day in a c program?
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above
What are valid signatures for the Main function?
What are the valid places to have keyword “break”?