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

I heard that you have to include stdio.h before calling printf. Why?

847


What is the function of volatile in c language?

906


What is difference between structure and union in c programming?

819


Explain a pre-processor and its advantages.

879


a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

4849


code for replace tabs with equivalent number of blanks

1950


What is #define?

821


What is the difference between local variable and global variable in c?

954


What is 1f in c?

2340


Explain what is the difference between a string and an array?

924


the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above

837


What is %lu in c?

952


What do you understand by friend-functions? How are they used?

977


What is the ANSI C Standard?

1038


How many data structures are there in c?

872