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   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
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 generate prime factors of a given integer?
 Question Submitted By :: Vasu
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Write a program to generate prime factors of a given integer?
Answer
# 1
int main()
{
	int n,num,i;
	printf("enter the num");
	scanf("%d",&num);
	n=num;
	printf("\n");
	for(i=2;i<=n/2;i++)
	{
		if(n%i==0)
		{
			prime(i);
		}
	}
}

void prime(int x)
{
	int i,f=0;
	for(i=2;i<=x/2;i++)
	{
		if(x%i==0)
		{
			f=1;
			break;
		}
	}
	if(f==0)
		printf(" %d",x);

}
 
Is This Answer Correct ?    0 Yes 3 No
Rajesh Kumar S
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
class foo { public: static int func(const char*& p) const; }; This is illegal, why? Google6
write the program for prime numbers? TCS7
What is encapsulation?  1
What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; main() { BAD g1; g1=1; printf("%d",g1); } ADITI2
Is there any restriction in how many arguments printf or scanf function can take? in which file in my c++ compiler i can see the code for implementation of these two functions??  2
what are the difference between ANSI C and Let Us c and Turbo C  1
How can I set an array's size at run time?  7
what is meant by c  4
Why doesn't C have nested functions?  1
Give a fast way to multiply a number by 7 Microsoft8
2)#include<iostream.h> main() { printf("Hello World"); } the program prints Hello World without changing main() the o/p should be intialisation Hello World Desruct the changes should be a)iostream operator<<(iostream os, char*s) os<<'intialisation'<<(Hello World)<<Destruct b) c) d)none of the above Siemens4
HOW DO YOU HANDLE EXCEPTIONS IN C? AppLabs2
Which of the following about automatic variables within a function is correct ? a.its type must be declared before using the variable b.they are local c.they are not initialised to zero d.they are global. TCS3
why TCS selected more student in the software field from all institution. TCS3
what will be the result of the following program ? char *gxxx() { static char xxx[1024]; return xxx; } main() { char *g="string"; strcpy(gxxx(),g); g = gxxx(); strcpy(g,"oldstring"); printf("The string is : %s",gxxx()); } a) The string is : string b) The string is :Oldstring c) Run time error/Core dump d) Syntax error during compilation e) None of these IBM2
main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); } CitiGroup3
regarding the scope of the varibles;identify the incorrect statement: a.automatic variables are automatically initialised to 0 b.static variables are are automatically initialised to 0 c.the address of a register variable is not accessiable d.static variables cannot be initialised with any expression TCS1
how to find that no is int or float?  4
how does the for loop work actually..suppose for the following program how it ll work plz explain to me for(i=5;i>=0;i--) prinf(i--); RMSI13
write a program to sort the elements in a given array in c language  2
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

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