I don't understand how it is equal to 120..
I don't understand how it is equal to 120..
Next time, paste your code between [code][/code] tags. A fuzzy picture is no use to us if we want to compile/quote/edit your program.
> for ( i = 1 ; i < x ; i++ )
How many times does this loop?
What are the values of i ?
> x *= i;
Do you know this is short for x = x * i; ?
Do you know how many times x gets multiplied by something?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.