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
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
What is pragma c?
Who developed c language and when?
What are the 5 types of inheritance in c ++?
What is the difference between array and pointer in c?
What is 1d array in c?
How to set file pointer to beginning c?
How do I create a directory? How do I remove a directory (and its contents)?
Is null always defined as 0(zero)?
Do you know the difference between malloc() and calloc() function?
What is indirection in c?
Why doesnt that code work?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
What is an array in c?
Write a program which returns the first non repetitive character in the string?