ALLInterview.com :: Home Page      
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   Errors
   Refer this Site  Refer This Site to Your Friends  Site Map  Contact Us      
   
 
Categories >> Software >> Programming Languages >> C
 
 


 

 
Question write the program for prime numbers?
 Question Asked At :: tcs, write a "c" program to count no of prime number upto 10, write a program to print all prime numbers from an array, assenture, infosys, aptech, 3.write a program in c to read n numbers in an array, the user should be able to search a particular number i
 Question Submitted By :: aaaa
I also faced this Question!!    
Answer Posted By  
 
Answer
#include<stdio.h>

int main()
{
int c,i,n;
c=0;
scanf("%d",&a);
for(i=2;i<a;i++)
if (n%i==0)
{
c=1;break;
}
if(c!=1)`("prime");
else printf ("not a prime");
}

Is This Answer Correct ?    110 Yes 89 No


 
  arfu
 
View All Answers