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
Can a local variable be volatile in c?
What is the process to create increment and decrement stamen in c?
How are structure passing and returning implemented?
Explain what is the difference between a string and an array?
what are # pragma staments?
What is the benefit of using an enum rather than a #define constant?
can anyone please tell about the nested interrupts?
What is array in c with example?
What is the heap?
Differentiate between null and void pointers.
Tell me what are bitwise shift operators?
What is a macro?
What is a protocol in c?
Is it possible to use curly brackets ({}) to enclose single line code in c program?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year