no biggie. Just making sure.

Printable View

- 05-24-2005FillYourBrain
no biggie. Just making sure.

- 05-24-2005AaA
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-2005Lionmane
Hey, wow! I'm learning factorials too! That was an awesome factorial program!

How does the *= work?

Thanks!

mw - 05-24-2005Thantos
x *= y is short hand for x = x * y

Same rule applies to += -= /= %= ^= &= etc - 05-28-2005Bella_Rosafine
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 );

5 * 4 * 3 * 2 * 1 = 120 :P

sorrry if i caused loads of cunfusion !! :P:P:P:P - 05-28-2005Bella_Rosaoh 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);

}