Answer :

LRev

Answer:

my_int=input('Enter an integer to calculate its factorial: ');

i=1;%Counter to the while loop

r=1;%To keep the result

while i<=my_int

   r=r*i;

   i=i+1;

end

display('The result is:')

r

Explanation:

The factorial is the multiplication of all positive integers from 1 to n , my_int is the value of n in the program, in a while loop you need a condition that is met until all the positive integers have been multiplied, i is the counter that allows this (starts has one and is increasing by one till it gets the value of n)  and also is useful to make the multiplication and r keeps the result of each step until the condition stop being met and then the program the program leaves the loop and displays the solution.

Other Questions