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

How do I use void main?

0 Answers  


write a c code "if you give a any decimal number then print that number in english alphabet"? ex: i/p: 552 o/p: five hundred fifty two ...

1 Answers   Philips,


How is a two dimensional array passed to function when the order of matrix is not known at complie time?

1 Answers   CSC,


convert 12345 to 54321 withoutusing strig

5 Answers  


p*=(++q)++*--p when p=q=1 while(q<=6)

0 Answers   KINPOE,






What is p in text message?

0 Answers  


What are # preprocessor operator in c?

0 Answers  


what is diff between localstatic and globalstatis variable possible 2 use in another file...?

2 Answers   HCL,


Write an algorithm for a program that receives an integer as input and outputs the product of of its digits. E.g. 1234 = 24, 705 = 0

4 Answers  


Difference between goto, long jmp() and setjmp()?

0 Answers   EXL,


Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

0 Answers  


C program to perform stack operation using singly linked list

3 Answers  


Categories