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 is the difference between scanf and fscanf?
What are reserved words with a programming language?
what are the 10 different models of writing an addition program in C language?
Is return a keyword in c?
Differentiate Source Codes from Object Codes
What is a union?
How do c compilers work?
Can a variable be both static and volatile in c?
What is file in c language?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
Explain the difference between the local variable and global variable in c?
Explain how are 16- and 32-bit numbers stored?
What will be the outcome of the following conditional statement if the value of variable s is 10?
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
Once I have used freopen, how can I get the original stdout (or stdin) back?