2 Lets say you wanted to calculate 13 Factorial 13 12 11
2. Let\'s say you wanted to calculate 13! (Factorial) (13 · 12 · 11 · 10 · 9 · 8 · 7 · 6 · 5 · 4 · 3 · 2 · 1).
 *As we progress through the multiplication, we multiply the previous value by the new value and subtract 1 from the previous value.
 Using a thought process similar to the factorial problem above, write a while loop that sums the
 numbers 1 through 100.
 Solution
1)
>> sum = double(0.0)
>>for n = 0:100
sum = sum + ( 1.0 / power(2,n) );
end
>> sum % sum always rounds to \"2\" because of internal rounding off , You need to increase the precision using digits()
2) I think the logic for your factorial program is wrong.
Before the start of the loop n = 13 and f =13. Now on the 1st iteration of the loop you multiply (13 *13), then multiply thsi value with 12 in second iteration and so on. In factorial case you should initialize f with \"1\" in the beginning.
Following is the code for the while loop to calculate the sum from 1 to 100
Kindly change the format of output using format command
>> format long
>> n = 100;
>> sum = 0;
while n > 0
sum = sum + n;
n = n - 1;
end
sum; % Your sum of 1 - 100

