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 meant by keywords in c?
Why c is called object oriented language?
How can I discover how many arguments a function was actually called with?
a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);
Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon
What is the use of typedef in structure in c?
What are the 5 elements of structure?
write a program to create a sparse matrix using dynamic memory allocation.
what are the advantages of a macro over a function?
How can I do graphics in c?
Explain how can you tell whether two strings are the same?
Write a program to identify if a given binary tree is balanced or not.
What is an auto variable in c?
What is the benefit of using #define to declare a constant?
What is a constant and types of constants in c?