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
I heard that you have to include stdio.h before calling printf. Why?
What is the function of volatile in c language?
What is difference between structure and union in c programming?
Explain a pre-processor and its advantages.
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.
code for replace tabs with equivalent number of blanks
What is #define?
What is the difference between local variable and global variable in c?
What is 1f in c?
Explain what is the difference between a string and an array?
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
What is %lu in c?
What do you understand by friend-functions? How are they used?
What is the ANSI C Standard?
How many data structures are there in c?