Computer Science, asked by goutamhebbar, 1 year ago

Write a pseudo-code to calculate the factorial of a given number.
Example: factorial of 5 = 5*4*3*2*1 = 120.
Note 1: Factorial of 0 is 1.
Appeared in InfyTQ.
Kindly answer.

Attachments:

Answers

Answered by charlie1505
17

Answer:

step 1:

declare number and factorial as integer variable.

step 2:

initialize Factorial=1

step 3:

enter value of Number

step 4:

check whether number=0, if not then number=1

step 5:

if yes then, factorial= factorial*number

step 6:

repeat step 4 and 5 until number=0

step 7:

print value of factorial

step 8:

stop

Answered by itsrksoni
63

Answer:

Factorial=1

input Number

if(Number==0) then

Factorial=1

else

while(Number!=0) do

Factorial=Factorial*Number

Number=Number-1

end-while

end-if

display Factorial

Similar questions