Write a program in QBASIC to accept a number from the user and calculate its factorial.
(hint: Factorial is the product of all positive integers less than or equal to a given
positive integer.
N! = 1* 2* 3* ....*N
Eg: 5! = 1*2*3*4*5=120 )
it's on Qbasic
Answers
Answered by
1
Answer:
CLS INPUT "Enter a Number: ", n fact = 1 FOR i = 1 TO n fact = fact * i NEXT i PRINT "Factorial of ";n;" is ";fact END. DECLARE SUB factorial CLS factorial END SUB factorial INPUT "Enter a Number: ", n fact = 1 FOR i = 1 TO n fact = fact * i NEXT i PRINT "Factorial of ";n;" is ";fact END SUB.
Similar questions