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 print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me... 332
which is an algorithm for sorting in a growing Lexicographic order 370
code for find determinent of amatrix 288
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot... 358
Is Exception handling possible in c language? 471
what is the diffrenet bettwen HTTP and internet protocol 368
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25 342
write a c program to print the next of a particular no without using the arithmetic operator or looping statements? 1487
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result 256
simple program of graphics and their output display 439
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []); 636
code for quick sort? 459
7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle. 254
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f 557
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5. 313
E-Mail New Answers        Answer Selected Questions