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
What is auto keyword in c?
what is a NULL Pointer? Whether it is same as an uninitialized pointer?
write a proram to reverse the string using switch case?
What is a class c rental property?
write a program fibonacci series and palindrome program in c
Is javascript written in c?
When should a type cast be used?
What is null in c?
What is a constant?
What is a pointer in c?
Is there a way to switch on strings?
Why can't I perform arithmetic on a void* pointer?
what are the different storage classes in c?
What is function in c with example?
What is static function in c?