Hey all, I'm a super-noob and basically I'm trying to finish off this code block for error checking and displaying multiple results from multiple checks.

Maybe that doesn't make sense what I typed but here is a run down of my code

I realize this is incomplete(missing loop for range test(1-5000)) but I can't quite seem to get a handle on satisfying all the problems associated with this block.user inputs a number and 'wants' to be told the factors of that number

what is a 'factor'

factor=division of the number inputted by another number which gives a remainder of zero

in other words

factor=(input/anumber==r0)

however, all the factors of the input must be displayed

so a test must be done for valid factors

'if factor is true, then display anumber used in factor formula'

'otherwise, if not true, then test the next number after the previously tested anumber until the input is reached, since every real/whole number has at least 2 factors (1 and the number itself)'

#include <stdio.h>

int main(void){

int factor=0;

int input=0;

int anumber=2;

printf("Enter a number (1-5000):");

scanf("%d",&input);

factor=(input%anumber);

if(factor>=1)

printf("The factors for %d are 1, & %d.",input,input);

else{

while(factor==0){

printf(", %d",anumber);

anumber=anumber+1;

}

}return 0;

}

In a nutshell, I need:

all the factors from a given input on the same line

if the input is 1, to simply display, The factor for 1 is 1.

disregard all non-valid factors

I've been cracking at this all day and bupkis.

I will note it's school related, but not an assignment/homework.

Any help is appreciated.

Thank you.