Posted: Mon Jul 22, 2002 3:02 pm
There are two problems:
i) There is an extra space after the '=' sign in each step and also when you printed the newline character along with some spaces.
ii) There is also a problem when the out put contains exactly 15 numbers after the '=' sign. Examine your code. Suppose there are 15 numbers in the output. then i==15 is satisfied and a newline is printed. But as there are not more then 15 numbers in the output no number is printed in the next line. And for the last "printf("\n");" there is another newline in the output. So for certain numbers there will be 2 newlines.
What u can do is just put the if(i==15) condition after the if(factors ==0)
condition.

i) There is an extra space after the '=' sign in each step and also when you printed the newline character along with some spaces.
Code: Select all
here---->>printf("%3d! = ", fact);
for (i = 0; i < 25; i++) {
if (i == 15)
here----->>printf("\n ");
if (factors[i] == 0)
break;
printf("%3d", factors[i]);
}
printf("\n");
What u can do is just put the if(i==15) condition after the if(factors ==0)
condition.
