Write a program that will input a positive integer and print out the list of its prime factors. Comment on the run time of your algorithm and state any limitations that you have imposed on the input integers

Salem commented: Go away you sponger -1

Recommended Answers

All 2 Replies

Scanf("%d",&n);  /*Reading the number*/
Printf("The prime factors of the given number are");
for (i =1; i<=n;i++)
 { 
     if(n%i==0) 
            printf("%d\t",i);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.