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


Please Help Members By Posting Answers For Below Questions

What do mean by network ?

648


What will be your course of action for a push operation?

659


What is the stack in c?

712


What are the application of void data type in c?

687


What is #line in c?

554






How can I write a function analogous to scanf?

647


What are the main characteristics of c language describe the structure of ac program?

604


Why do we use pointer to pointer in c?

590


What is the full form of getch?

577


How can I delete a file?

625


What is 2c dna?

599


Write a code to generate divisors of an integer?

630


Why is c called a mid-level programming language?

719


What is an endless loop?

796


What are local variables c?

543