write a program to find the given number is prime or not
Answer Posted / rabindra nath das
#include<stdio.h>
#include<conio.h>
void main()
int n,k,fl=0,r;
clrscr();
printf("\n Enter the number==>>");
scanf("%d",&d);
for(k=2;k<=n/2 && fl==0;k++)
{
r=n%k;
if(r==0);
fl=1;
}
if(fl==0)
printf("\n %d is a prime number",n);
else
printf("\n %d is not prime number",n);
getch();
}
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
What are the rules for the identifier?
How can I get random integers in a certain range?
Is c++ based on c?
Differentiate between a for loop and a while loop? What are it uses?
What is the scope of static variable in c?
What are the different data types in C?
What is void pointers in c?
What are the features of the c language?
what is bit rate & baud rate? plz give wave forms
Why c is faster than c++?
What are the different types of control structures in programming?
How are 16- and 32-bit numbers stored?
What does %c mean in c?
When can you use a pointer with a function?
What is the purpose of realloc()?