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
   Testimonials 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 In Companies :: Aptech, Infosys, TCS,     < I also faced this Question! >
 Question Submitted By :: aaaa
  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
 
 
Please Help Members By Posting Answers For Below Questions
 
 Question Views   Select
 
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do? 513
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit 322
1)what are limitations for recursive function? 2)write a program to read a text file and count the number of characters in the text file 842
2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier. &#61550; Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed. &#61550; When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed. &#61550; Sequence of take-off is the sequence of addition to the waitlist 1381
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code 368
how could explain about job profile 304
hi any body pls give me company name interview conduct "c" language only 395
find out largest elemant of diagonalmatrix 427
write a program for the normal snake games find in most of the mobiles. 545
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix. 1510
what will be maximum number of comparisons when number of elements are given? 227
How will you find a duplicate number in a array without negating the nos ? 400
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings. 567
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot... 288
Wt are the Buses in C Language 1380
E-Mail New Answers        Answer Selected Questions