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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
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!!     Rank Answer Posted By  
 
Answer
main()
{
int i,j=2,ch=0;
clrscr();
       printf("\nENTER ANY NUMBER");
       scanf("%d",&i);
  while(j<=i/2)
       {
        if(i%j==0)
          {
            printf("%d IS NOT PRIME",i);
            ch=1;
            break;
          }
        else
          {
           j++;
          }
      }
 if(ch==0)
   {
   printf("%d IS PRIME",i);
   }
}

 
Akhilesh Singh(m.c.a-iisem Ois
 
View All Answers
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2012  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com