// Mark Ignacio & Kevin Chau
// 09/23/11
//

#include <stdio.h>

int main() {

    int num;

    // Get the user's input.
    printf("Enter a positive integer greater than 1.\n");
    scanf("%d", &num);

    while (num < 2){
        printf("Sorry, that input is not valid.\n");
        printf("Enter a positive integer greater than 1.\n");
        scanf("%d", &num);
    }

    int num_factors = 0, sum_factors= 0, product = 1;

    printf("\nHere is a list of the positive factors of %d:\n", num);
    int i;

    // Keep track of each running tally, by trying one factor at a time and
    // updating, if necessary.
    for (i = 1; i <= num; i++ ){
        if (num % i == 0){
            printf("%d ", i);
            num_factors++;
            sum_factors += i;
            product = product * i;
        }
    }

    // Print out the results.
    printf("\n\nThe number of positive factors of %d is %d.\n", num, num_factors);
    printf("The sum of the positive factors of %d is %d.\n", num, sum_factors);
    printf("The product of the positive factors of %d is %d.\n", num, product);

    return 0;
}
