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 can I determine whether a machines byte order is big-endian or little-endian?
Differentiate between ordinary variable and pointer in c.
which type of aspect you want from the student.
What is the scope of local variable in c?
What is static memory allocation? Explain
Is null a keyword in c?
What is double pointer?
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
Explain what is a program flowchart and explain how does it help in writing a program?
Where in memory are my variables stored?
What is volatile variable in c with example?
What are the three constants used in c?
Can two or more operators such as and be combined in a single line of program code?
What is main () in c language?
Can you subtract pointers from each other? Why would you?