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 an expression?
What is the difference between abs() and fabs() functions?
What does & mean in scanf?
Why isnt there a numbered, multi-level break statement to break out
What are the types of functions in c?
What is sorting in c plus plus?
Explain how can you determine the size of an allocated portion of memory?
Can you please compare array with pointer?
Where does the name "C" come from, anyway?
Why malloc is faster than calloc?
Why is python slower than c?
Explain is it valid to address one element beyond the end of an array?
Describe static function with its usage?
What is the use of ?
the question is that what you have been doing all these periods (one year gap)