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

int a=20; int b=30; int c=40; printf("%d%d%d"); what will be the output?

5 Answers   CMC,


what is diffrence between string and character array?

1 Answers  


how can we print  hellow world programme without using semicolon

3 Answers  


Can we change the value of static variable in c?

0 Answers  


pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)

0 Answers   Subex,






void main() {int i=2; printf("%d%d%d",i,++i,i++); getch(); }

9 Answers  


What is c token?

0 Answers  


Can you define which header file to include at compile time?

0 Answers   Aspire, Infogain,


Write a program to swap two numbers without using a temporary variable?

0 Answers   Infosys,


suppose there are five integers write a program to find larger among them without using if- else

2 Answers  


What are the 5 types of inheritance in c ++?

0 Answers  


What is cohesion in c?

0 Answers  


Categories