write the program for prime numbers?
Answer Posted / sudesh kumar
#include<iostream.h>
#include<conio.h>
void main()
{
int no,i,r,p=1;
cout<<"enter a no";
cin>>no;
for(i=2;i<no;i++)
{
if(r==no%i)
{
p=0;
break;
}
}
if(p==0)
{
cout<<"the prime no";
}
else
{
cout<<"the no is note prime";
}
getch();
}
| Is This Answer Correct ? | 13 Yes | 14 No |
Post New Answer View All Answers
Explain what is a const pointer?
can any one tel me wt is the question pattern for NIC exam
What are dangling pointers? How are dangling pointers different from memory leaks?
Explain the properties of union. What is the size of a union variable
What is extern storage class in c?
When should I declare a function?
Difference between Shallow copy and Deep copy?
What is a constant and types of constants in c?
Can include files be nested? How many levels deep can include files be nested?
What is a global variable in c?
What is a void pointer? When is a void pointer used?
How many types of sorting are there in c?
Explain bit masking in c?
Write a program to swap two numbers without using the third variable?
When should the volatile modifier be used?