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
When should a type cast be used?
Which is best book for data structures in c?
How can you determine the size of an allocated portion of memory?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
Explain what is a 'locale'?
What are multidimensional arrays?
What is an endless loop?
What is the difference between local variable and global variable in c?
What is a pointer on a pointer in c programming language?
What is the explanation for prototype function in c?
Is that possible to add pointers to each other?
What does it mean when the linker says that _end is undefined?
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
how to build a exercise findig min number of e heap with list imlemented?
Differentiate Source Codes from Object Codes