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
What is the difference between call by value and call by reference in c?
What does & mean in scanf?
where are auto variables stored? What are the characteristics of an auto variable?
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
What are the storage classes in C?
Differentiate between null and void pointers.
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
Can we declare variable anywhere in c?
How does selection sort work in c?
What are the types of data structures in c?
Why can't I perform arithmetic on a void* pointer?
4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.
If null and 0 are equivalent as null pointer constants, which should I use?
What is header file definition?
What is the significance of scope resolution operator?