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
How many bytes is a struct in c?
What is this pointer in c plus plus?
Why is not a pointer null after calling free?
Define VARIABLE?
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
What are formal parameters?
What is infinite loop?
What is the difference between NULL and NUL?
How important is structure in life?
Does c have function or method?
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
What is difference between structure and union with example?
Is linux written in c?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
code for replace tabs with equivalent number of blanks