I am writing a simple prgram to show that factors of an integer input

I'm not sure if i'm going about writing this the right way, I get an output, but I need to somehow restrict the display to only show the integer results instead of all the results i have written the following:

But the output of this is not what i want, say if i enter 7, t gives meCode:#include <stdio.h> int main (void) { int input; int a; int k; printf("Enter number to be factorised:\n"); scanf("%d", &input); printf("the factors of %d are\n", input); for (k=1; k<=input; k++) { a = input/k; printf("%d\n", a); } return 0; }

but what i want it to show is, say if i enter 1001Code:the factors of 7 are 7 3 2 1 1 1 1

any suggestions?Code:the factors of 1001 are 1001 143 91 77 13 11 7 1