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 new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
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
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com