ALLInterview.com :: Home Page KalAajKal.com
 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
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Write a program to print all the prime numbers with in the 
given range
 Question Submitted By :: Advsekaran
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Write a program to print all the prime numbers with in the given range
Answer
# 1
/* Program to print all prime number between a range through
function */
#include
#include
void print_prime(int r1,int r2)
{
int n=0,d=0,j;
clrscr();
for(n=r1;n<=r2;++n)
{
for(j=2;j
{
if(n%j==0)
{
d++;
break;
}
}
if(d==0)
printf("\t%d",n);
d=0;
}
}
void main()
{
int n1=0,n2=0;
printf("\n Enter range1 & range2 =>");
scanf("%d%d",&n1,&n2);
print_prime(n1,n2);
getch();
}
 
Is This Answer Correct ?    0 Yes 4 No
Smi
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what is a far pointer TCS9
what is const volatile?  1
differentiate between const char *a; char *const a; and char const *a; HCL1
Identify the correct argument for the function call fflush () in ANSI C: A)stdout B)stdin C)stderr D)All the above Accenture3
how to print "hai" in c?  10
What is volatile in c language? HCL1
what is the difference between arrays and linked list Tech-Mahindra15
main() { int i,j,A; for(A=-1;A<=1;A++) prinf("%d\t",!!A); }  5
define function Assurgent4
void swap(int a,int b) { a=a+b; b=a-b; a=a-b; } in this code always gives the same result for all case TCS7
What is the relation between # and include<stdio.h> HCL3
what is the diff b/w static and non static variables in C. Give some examples plz. Wipro2
enum day = { jan = 1 ,feb=4, april, may} what is the value of may? a)4 b)5 c)6 d)11 e)none of the above HCL2
Reverse a string word by word??  6
Unsigned char c; for ( c=0;c!=256;c++2) printf("%d",c); No. of times the loop is executed ? Mascot3
Write a routine that prints out a 2-D array in spiral order! Lucent1
macros and function are related in what aspect? a)recursion b)varying no of arguments c)hypochecking d)type declaration HCL8
what is meant by c  4
Find string palindrome 10marks Honeywell5
1,1,5,17,61,217,?,?.  3
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

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