if anyone can please help i have to turn in this program by 2moro night and ive been up all night trying to figure it out. i had to write a program to find all the factors of any given number typed as long as it is a possitive interger. then i have to 1. list the possitive intergers. 2. show how many intergers there are. 3 add all the intergers and 4 multiply them. i will paste what i have so far but i am having trouble with showing 2-4! please just give me advice or anything. thanx
Code:
#include <stdio.h>
int main () {
int val, factor, sum;
int product, total;
printf("Enter a positive integer greater than one: \n");
scanf("%d", &val);
factor=1;
if(val<0){
printf("Sorry, that input is not valid. \n""Enter a positive integer greater than one.");
}
else{
printf("Here is a list of the possitive intregers of %d\n", val);
while(factor<=val){
if(val%factor==0){
printf("%d ", factor);
}//if end
factor=factor+1;
}//while end
//sum
sum=1;
while(sum<=val);{
if(val%sum==0){
}
total= sum+sum;
}//while end
printf("%d\n",total);
}//else end
printf("\n");
system("pause");
return 0;
}