write an interactive program to generate the divisors of a
given integer.
Answer Posted / pradeep
same program as above, optimising it a little bit.
#include<stdio.h>
int main()
{
int n,i=1;
printf("Value for n\n");
scanf("%d\n",&n);
while(i <= n/2)
{
if(n%i == 0)
printf("%d\n",i);
i++;
}
printf("%d\n",n);
}
| Is This Answer Correct ? | 2 Yes | 7 No |
Post New Answer View All Answers
What do the functions atoi(), itoa() and gcvt() do?
c program for searching a student details among 10 student details
What does sizeof function do?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
What is wrong with this program statement? void = 10;
How #define works?
define string ?
Write the control statements in C language
How do shell structures work?
Why do we need functions in c?
What is indirection? How many levels of pointers can you have?
Explain high-order and low-order bytes.
What is "Duff's Device"?
What is an array in c?
#include