1.

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 givenpositive integer.N! = 1* 2* 3* ....*NEg: 5! = 1*2*3*4*5=120 ) it's on Qbasic​

Answer»

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.



Discussion

No Comment Found