1.

Write an algorithm to read a number and find its factorial (n!=n*(n-1)*(n-2) * …..3*2*1)

Answer»

Step 1 : Start 

Step 2 : Fact <—1 

Step 3 : Read a number and store in n 

Step 4 : If n=0 then go to step 7 

Step 5 : Fact <— Fact *n 

Step 6 : n <— n-1 go to step 4 

Step 7 : Print “Factorial is fact” 

Step 8 : Stop.



Discussion

No Comment Found

Related InterviewSolutions