Hi,in for loop counter is incrementing from 1 to 'number',every time
counter is multiplying with the value of total and this value is
storing in the total.
now take following example.
your programe is :
for (int counter = 1; counter <= number; counter++)
total *= counter;
now let number equal to 3.
Total is initialised to '1'.
counter number total
1 3 1 //at starting of loop
1 3 1*1=1 //in first rotation
2 3 1*2=2 //second rotation
3 3 2*3=6 //third rotation
when counter is 4 loop breaks,so value of total is 6 i.e 3!.