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
How can I split up a string into whitespace-separated fields?
What is logical error?
What is optimization in c?
What are multidimensional arrays?
What is the difference between functions getch() and getche()?
What does c in a circle mean?
What is the sizeof () operator?
What is cohesion in c?
Do character constants represent numerical values?
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.
What does calloc stand for?
What is bubble sort technique in c?
shorting algorithmS
What is the full form of getch?
Why do we need a structure?