write a program to find the given number is prime or not

Answers were Sorted based on User's Feedback



write a program to find the given number is prime or not..

Answer / alex

here is answer
http://www.prepjunk.com/151/program-to-find-the-given-number-is-prime-or-not

Is This Answer Correct ?    2 Yes 0 No

write a program to find the given number is prime or not..

Answer / 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

More C Interview Questions

Why should I use standard library functions instead of writing my own?

0 Answers  


Why is sprintf unsafe?

0 Answers  


how to print the character with maximum occurence and print that number of occurence too in a string given ?

0 Answers   Microsoft,


What does int main () mean?

0 Answers  


The operation of a stair case switch best explains the a) or operation b) and operation c)exclusive nor operation d)exclusive or operation Which of the following is/are syntactically correct? a) for(); b) for(;); c) for(,); d) for(;;);

1 Answers   HCL, Public Service Commission,






Why is c fast?

0 Answers  


What tq means in chat?

0 Answers  


What are 'near' and 'far' pointers?

0 Answers  


main() { static int ivar=5; printf("%d",ivar--); if(ivar) main(); }

3 Answers   CSC,


What is Lazy evaluation in C? Give an example.

1 Answers  


Describe the difference between = and == symbols in c programming?

0 Answers  


say the following declaration is correct nr not. int b=a,n=0;

4 Answers   Wipro,


Categories