Write a program to generate prime factors of a given integer?

Answer Posted / priyanka chauhan

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
clrscr();
printf("Enter the no: ");
scanf("%d",&n);
for(j=2;j<=n;j++)
{
if(n%j==0)
{
for(i=2;i<=j-1;i++)
{
if(j%i==0)
break;
}
if(i==j)
printf("%d ",j);
}
}
getch();
}

Is This Answer Correct ?    23 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to print the character with maximum occurence and print that number of occurence too in a string given ?

2036


how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software

2800


Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?

981


Does sprintf put null character?

601


write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)

1627






What is array of pointers to string?

570


Tell me with an example the self-referential structure?

566


a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

685


What is the difference between if else and switchstatement

1312


What is the difference between ‘g’ and “g” in C?

2543


Is c is a low level language?

566


Suppose we have a table name EMP as below. We want to perform a operation in which, I want to change name ‘SMITH’ from as ‘SMITH JAIN’. Also I want to change the name of the column from ENAME to E_NAME. EMPNO ENAME JOB MGR HIREDATE SAL 7369 SMITH Coder 7902 17-DEC-80 800 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 7521 WARD SALESMAN 7698 22-FEB-81 1250

1509


What are the valid places to have keyword “break”?

651


Explain bitwise shift operators?

632


What is #include conio h?

594