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 :: Accenture, 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
 
Write a program to add the following ¼+2/4+3/4+5/3+6/3+... (Like up to any 12 no.s) 1907
using for loop sum 2 number of any 4 digit number in c language 445
the data type used for unlimited value in c and how to do this program 323
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon 3416
How to implement a packet in C 1102
Write a progarm to find the length of string using switch case? 416
the question is that what you have been doing all these periods (one year gap) 509
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy. 1960
how to write a c program to print list of fruits in alpabetical order? 318
can anyone please tell about the nested interrupts? 474
in linking some of os executables are linking name some of them 411
how to build a exercise findig min number of e heap with list imlemented? 351
write an algorithm to display a square matrix. 953
what are non standard function in c 271
what is the difference between auto and static keywords 475
E-Mail New Answers        Answer Selected Questions