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 are the 5 organizational structures?
Can a function argument have default value?
Explain how are 16- and 32-bit numbers stored?
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
what is a constant pointer in C
Why is c called "mother" language?
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
int i=10; printf("%d %d %d", i, i=20, i);
What is an array in c?
What is difference between union and structure in c?
Why static variable is used in c?
How can you find the exact size of a data type in c?
What is the difference between far and near ?
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
What do you mean by dynamic memory allocation in c?