answersLogoWhite

0


Best Answer

since factorial is for example , the factorial of 5 = 5 (5-1)(5-2)(5-3)(5-4)

that means the last number to subtract from 5 is 4 , which is (n-1)

ie the factorial of any number is (n-0)(.............)(n-(n-1))

to write this ,

5 REM to calculate the factorial of any number

6 DIM fac AS INTEGER

LET fac = 1

10 INPUT "enter the number to find its factorial "; a ' variable a

15 FOR b = 0 TO (a-1) 'numbers that will be subtracted from the " a"

20 c= a -b 'each number in the factorial calculation

25 fac = fac * c 'to compute each multiplication in the factorial

30 NEXT b

35 PRINT 'to leave a line

40 PRINT fac

45 END

note this due to some unattained raesons works for numbers 0 to 7

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you create factorial program in qbasic?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Is qbasic a high level language?

The QBASIC program actually comes in 2 different flavors... A> QBASIC interpreter program: QBASIC Version 1.1 B> QBASIC compiler program: QBASIC 4.5/or, QB64/or, -etc. ...so, the answer is that this programming language comes in both forms: 'interpreter/compiler' versions; and, you have to select which of these you would prefer to download and use. *NOTE*: The compiler version of the language tends to be much larger; whereas, the interpreter version of the language tends to be small/very compact, indeed; thus, the interpreter tends to take up far less disk space. Many people start off their programming career by using QBASIC version 1.1 'interpreter' program; in order to learn 'how to' program. The interpreter version of the program can only create plain text (.bas) files; the which code CANNOT be shared with others; (not unless the persons who you are sharing this type of code with do already have a copy of the QBASIC interpreter program installed on their own computer). Then, later on, down the line...when they have become fully capable programmers themselves; they go and download a QBASIC 'compiler' program version, instead; which will allow them to go and create stand alone (.exe) program files that they can share with anybody. This is because (.exe) program files can RUN/execute entirely independently of the QBASIC program itself.


What command statement terminates the qbasic program?

END '...END of program/halt program code execution. *NOTE*: There should be only 'one' END statement written inside of a QBASIC program. I have seen example code where they use multiple END statements; this is wrong!


How do you write a qbasic program to find area and circumerence of a circle?

Write a program that calculates the area of a triangle in QBASIC


Write a program in qbasic to make a hut using print statemant?

a triangle then a square :)


Write a C-like program fragment that calculate the factorial function for argment 12 with do while loop?

#!/usr/bin/perl print factorial($ARGV[11]); sub factorial { my($num) = @_; if($num == 1) { return 1; # stop at 1, factorial doesn't multiply times zero } else { return $num * factorial($num - 1); # call factorial function recursively } }

Related questions

Is qbasic a high level language?

The QBASIC program actually comes in 2 different flavors... A> QBASIC interpreter program: QBASIC Version 1.1 B> QBASIC compiler program: QBASIC 4.5/or, QB64/or, -etc. ...so, the answer is that this programming language comes in both forms: 'interpreter/compiler' versions; and, you have to select which of these you would prefer to download and use. *NOTE*: The compiler version of the language tends to be much larger; whereas, the interpreter version of the language tends to be small/very compact, indeed; thus, the interpreter tends to take up far less disk space. Many people start off their programming career by using QBASIC version 1.1 'interpreter' program; in order to learn 'how to' program. The interpreter version of the program can only create plain text (.bas) files; the which code CANNOT be shared with others; (not unless the persons who you are sharing this type of code with do already have a copy of the QBASIC interpreter program installed on their own computer). Then, later on, down the line...when they have become fully capable programmers themselves; they go and download a QBASIC 'compiler' program version, instead; which will allow them to go and create stand alone (.exe) program files that they can share with anybody. This is because (.exe) program files can RUN/execute entirely independently of the QBASIC program itself.


What command statement terminates the qbasic program?

END '...END of program/halt program code execution. *NOTE*: There should be only 'one' END statement written inside of a QBASIC program. I have seen example code where they use multiple END statements; this is wrong!


What is the explanation for the two modes of QBASIC?

(1) Immediate mode In this mode, QBASIC performs the command/instruction that we type in immediately after we press the enter key. (2) Program mode In this mode, the instructions/commands we type in are not performed as we type them in, but are first stored in the computer memory as a program. This program can be executed later, at a high speed.


How do you write a qbasic program to find area and circumerence of a circle?

Write a program that calculates the area of a triangle in QBASIC


C program to find factorial of a no?

this is a code for calculating it recursivelly: float Factorial (float n) { if (n<=1) return 1.0; else return n* Factorial(n-1); }


Write a program in qbasic to make a hut using print statemant?

a triangle then a square :)


What has the author H Tornsdorf written?

H. Tornsdorf has written: 'Windows 3.1 - Trucos y Consejos' 'QBasic for beginners' -- subject(s): QBasic (Computer program language)


What characteristics in quickbasic?

CHOICE OF EITHER 32 BIT/OR ELSE, 64 BIT QBASIC PROGRAM VERSIONS There are both 32 bit/64 bit QBASIC program versions. You have to select which is the correct version that will run on your own operating system. For example,... -> Windows 95/98/XP, runs the 32 bit version(s) -> Windows 7 runs the 64 bit version CHOICE OF EITHER QBASIC 'INTERPRETER'/OR ELSE, 'COMPILER' VERSIONS QBASIC Version 1.1 was the original version; however, it is 'interpreter' only. This means you CANNOT use it to create stand alone [.exe]cutable files with. QBASIC Version 4.5 is a 'compiler' version; which CAN be used to create stand alone [.exe]cutable files with. QB64 is the 64 bit 'compiler' version which runs on 64 bit platforms; it can also be used to create stand alone [.exe]cutable files with.


Program for finding the factorial of the two given number using constructor?

kjhk


Write a C-like program fragment that calculate the factorial function for argment 12 with do while loop?

#!/usr/bin/perl print factorial($ARGV[11]); sub factorial { my($num) = @_; if($num == 1) { return 1; # stop at 1, factorial doesn't multiply times zero } else { return $num * factorial($num - 1); # call factorial function recursively } }


How do you write a program that calculate factorial in javascript?

function factorial(n) { var x=1; while(n>1) x*=(n--); return x; }


How do you write a Qbasic program to display these Numbers-0112358132134?

you do this 10 print "0112358132134" use the whole of the thing