muskan3389830 muskan3389830
  • 28-12-2020
  • Computers and Technology
contestada

to print factorial of any
input number
QBASIC​

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 02-01-2021

Answer:

The program in QBasic is as follows;

PRINT "Number: "

INPUT N

LET FACT = 1

FOR I = 1 TO N

     FACT = FACT * I

NEXT I

PRINT FACT

END

Explanation:

This prompts user for number

PRINT "Number: "

This accepts input from the user

INPUT N

This initializes the factorial to 1

LET FACT = 1

This iterates through the number the user inputs and calculates its factorial

FOR I = 1 TO N

     FACT = FACT * I

NEXT I

This prints the factorial

PRINT FACT

The program ends here

END

Answer Link

Otras preguntas

In this box-and-whisker plot, what is the median value of the data? A. 48 B.53 C. 56 D. 58
Can Someone please help me solve this problem?
how many moles of H2SO4 are present in 3.63 liters of a 0.954 M solution?
Which of the following lists is in order from least to greatest? |-2|, 4 -1, , 3 × 10 -2 4 -1, 3 × 10 -2, |-2|, , 3 × 10 -2, |-2|, 4 -1 3 × 10 -2, 4 -1, , |-2|
The product of two numbers is 48 and the difference of those numbers is 13 what are the numbers?
How do you do this ? Can someone explain and help
Cedric gathered information about space objects from a reliable website. The information is shown in the table. Help Cedrick identify space object A. Space Obje
how do I answer these questions ??
True or false? It is not necessary to include a professional letterhead on professional medical office correspondence.
Why did the U.S enter the vietnam war?