write the program for prime numbers?
Answer Posted / oza priyanka
#include<stdio.h>
void main()
{
int num,i,cnt;
clrscr();
printf("\n\nEnter the number = ");
scanf("%d",&num);
for(i=2,cnt=0;i<num;i++)
{
if(num%i==0)
cnt=1;
}
if(cnt==0)
printf("\n\nprime number");
else
printf("\n\n not a prime number");
getch();
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is the purpose of void in c?
How is a structure member accessed?
difference between object file and executable file
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
How do I use void main?
What is the difference between malloc() and calloc()?
How can I swap two values without using a temporary?
What is integer constants?
What is the difference between c &c++?
Differentiate between full, complete & perfect binary trees.
What does struct node * mean?
How can I insert or delete a line (or record) in the middle of a file?
What is the symbol indicated the c-preprocessor?
How many levels of pointers have?
any "C" function by default returns an a) int value b) float value c) char value d) a & b