Здесь много чего не так. Я написал комментарии, чтобы объяснить:
int numberm1; // Variable not initialized, so it has an undefined value
numberm1 > 1; // This merely calculates a boolean value which is discarded
int number, right_digit, factorial; // All of these are undefined
// right_digit is unused
NSLog(@"Ill Make Your Number A Factorial");
NSLog(@"Enter A Number");
scanf("%i", &number); // number now maybe contains the value given by the user
// except you should use %d instead of %i, so I think the behavior here is still undefined
// Also, the value of numberm1 is still undefined
while (numberm1 > 1) { // If the compiler initializes all variables to 0,
// then this loop never runs.
numberm1 = number;
numberm1 -= 1; // Why not say numberm1 = number - 1; ?
factorial = number *= numberm1; // number is now number * numberm1, which
// means if number was > 2, then on the next
// step of the loop, numberm1 will now be even
// larger, leading to a loop that only ends after
// number overflows into the negatives...
}
Вместо этого вы хотите сделать следующее:
int number;
int factorial = 1;
NSLog(@"I\'ll make your number a factorial");
NSLog(@"Enter a number");
scanf("%d", &number);
while (number > 1) {
factorial *= number--; // This makes factorial equal factorial * number
// Then it decrements the value of number by 1
}
Но даже в этом случае факториал очень быстро переполнится.