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
Differentiate between static and dynamic modeling.
How do I use void main?
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
What is file in c language?
What are the different types of objects used in c?
Is main an identifier in c?
What does %c do in c?
What is a shell structure examples?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
Are negative numbers true in c?
How can a number be converted to a string?
What does the characters “r” and “w” mean when writing programs that will make use of files?
State the difference between x3 and x[3].
Explain about the functions strcat() and strcmp()?
Explain how do you print an address?