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                      
tip   To Refer this Site to Your Friends   Click Here
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
#include<stdio.h>
main()
{
int i,n,count=0;
printf("enter a no.");
scanf("%d",&n);
for(i=2;i<n;i++)

{
if(n%i==0)
 {
count++;
 }
}
if(count>1)
 {
printf("not  prime no.");

}
else
printf("prime");
}

 
Venkat Reddy
 
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