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 difference between the = symbol and == symbol?
What is %s and %d in c?
What does the c in ctime mean?
Is calloc better than malloc?
What is the use of function in c?
What is structure in c definition?
What is pointer to pointer in c?
What are examples of structures?
What is type qualifiers?
Write a program to reverse a given number in c language?
What is wrong with this declaration?
Why c language is called c?
What does a pointer variable always consist of?
What is signed and unsigned?
Is linux written in c?