write an interactive program to generate the divisors of a
given integer.

Answer Posted / neo

#include <stdio.h>

void div(int n){
int i=2;
while(n%i!=0 && i!=n){
i++;
}
printf("%d ",i);
if(i!=n){
div(n/i);
}

}

main(){
int i;
printf("Enter number:");scanf("%d",&i);
printf("1 ");
div(i);
}

Is This Answer Correct ?    25 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I split up a string into whitespace-separated fields?

821


What is logical error?

865


What is optimization in c?

759


What are multidimensional arrays?

880


What is the difference between functions getch() and getche()?

844


What does c in a circle mean?

775


What is the sizeof () operator?

802


What is cohesion in c?

750


Do character constants represent numerical values?

1087


Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.

888


What does calloc stand for?

855


What is bubble sort technique in c?

776


shorting algorithmS

2034


What is the full form of getch?

895


Why do we need a structure?

800