# Basic Factorial from 1-10

Show 80 post(s) from this thread on one page
Page 2 of 2 First 12
• 05-24-2005
FillYourBrain
no biggie. Just making sure.
• 05-24-2005
AaA
ItsMe and FillYourBrain: Thanks a ton for your help. I really appreciate it. I'm going to look at these examples and apply them to my exercise. Again, sorry for my stubborness. I'm still a rookie at this. I appreciate the patience.

Cheers!
• 05-24-2005
Lionmane
Hey, wow! I'm learning factorials too! That was an awesome factorial program!

How does the *= work?

Thanks!

mw
• 05-24-2005
Thantos
x *= y is short hand for x = x * y
Same rule applies to += -= /= %= ^= &= etc
• 05-28-2005
Bella_Rosa
fine
fine I guess I should have given more explaination 2 my code :P
ok I assumed that the user would want to tell the program which numbers it wants it to find the factorial to :P

Code:

```int i  , sum = 1 ; printf("Enter value"); scanf("%d" , & value ); for ( i = value ; i  > 0 ; i-- ) sum = sum * i ; printf("The result is % d \n" , sum );```
so if the user enters 5 for example it would resul in
5 * 4 * 3 * 2 * 1 = 120 :P
sorrry if i caused loads of cunfusion !! :P:P:P:P
• 05-28-2005
Bella_Rosa
oh yeah
Also forgot to declaure value as int :P
Code:

``` int main() { int i , value , sum = 1 ; printf("Enter value"); scanf("%d" , & value ); for ( i = value ; i  > 1 ; i-- ) sum = sum * i ; printf("The result is % d \n" , sum ); return(0); }```
Show 80 post(s) from this thread on one page
Page 2 of 2 First 12