Report Bug

Qus

Fill in the line of the following Python code for calculating the factorial of a number.

def fact(num):      if num == 0:           return 1      else:          return _____________________
Qusकिसी नंबर के फ़ैक्टोरियल की कॅल्क्युलेटिंग के लिए निम्नलिखित Python कोड की लाइन भरें।


A. num*fact(num-1)
B. (num-1)*(num-2)
C. num*(num-1)
D. fact(num)*fact(num-1)


Solution
A. num*fact(num-1)



Explanation
Suppose n=5 then, 5*4*3*2*1 is returned which is the factorial of 5.
Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad