How do you create factorial program in qbasic?
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
Is there a modern equivalent of Qbasic?
Before QBASIC there was...
BASIC
BASICA
The QBASIC programming language is a modern form of old BASIC programming languages which came before it; these older BASIC's used such things as, line numbers.
10 PRINT "Hello, world!" : REM *** Old BASIC line statement
QBASIC code, however, doesn't need to use line numbers, anymore; and, this creates much simpler/clearer/cleaner code/which is also quicker to write/debug.
PRINT "Hello, world" '*** QBASIC line statement
However, now-a-days, QBASIC is a rather outdated programming language which has been superceded by...
VB/Visual BASIC
VBA/Visual BASIC for Applications
VBScript/Visual BASIC Script
VB.NET/Visual BASIC.NET
VB.NET, is the latest BASIC programming language version offering from the software company, Microsoft.
The Visual BASIC family of programming languages uses OOP/Object Oriented Programming techniques; where you can use a library of pre-built software objects; this makes coding much faster...leading to RAD/Rapid Application Development...because it means that by making full use of these re-usable software objects; then, programmers can write much less code; which in some cases can cut software development time down by half/or, more...!
How do you write a Qbasic program to display these Numbers-0112358132134?
you do this
10 print "0112358132134"
use the whole of the thing
How do you use MID function in qbasic?
...QBASIC program code...
name$="Jack"
startCharPos%=2
howManyChars%=2
PRINT MID$(name$,startCharPos%,howManyChars%)
...output...
ac
EXPLANATION
The MID$() function allows you to select characters from out of a string.
In the above case the string is,...
name$="Jack"
...where...
J= string position 1
a= string position 2
c= string position 3
k= string position 4
...thus, if we select MID$(name$,2,2)...
...this code is actually saying...select from the name...the character which begins at position 2 = a/and, extract 2 characters going along from there... = ac.
How do you open a saved Qbasic file in QBASIC itself to edit it?
IF THE QBASIC IDE/INTEGRATED DEVELOPEMENT ENVIRONMENT *IS* ALREADY OPEN
Inside of QBASIC IDE/Integrated Development Environment...; you load in QBASIC programs as follows...
1. Use your mouse to click the QBASIC Menu option being seen top right...
File > Open
...then, browse through the file list box to load your chosen program file.
2. Alternatively, you can also use keyboard short cut...
[ALT]+[F], this opens up the file menu...then, press [O]
...does exactly the same as above
IF THE QBASIC IDE/INTEGRATED DEVELOPMENT ENVIRONMENT IS *NOT* ALREADY OPEN
3. Another way is to open up a command line window prompt: (>)...
Click [Start] button
...then, type: Command
.../or, type: Cmd
...at least, one of the above should work...
...and, run the QBASIC program from there...
by typing in after the command line prompt: (>)...
c:\>
cd, means, change directory folder...
cd C:\pathToQbasic
For example the file path name to where my version of QBASIC is stored here...
c:\basic\qb64
So, I would first change to this folder directory by typing in after the prompt: (>)...
c:\>cd c:\basic\qb64
...this changes my command line prompt: (>) to say...
c:\basic\qb64>
Inside of the [qb64] folder directory, I wrote a very simple program called:
hw.bas
...which contains the following single line of code...
PRINT "Hello, world!"
I can launch both the QBASIC program: [qb64.exe]/and, at the same time load in my chosen program file: [hw.bas], by typing after the command line prompt: (>)...
C:\Basic\qb64>qb64 hw.bas
...the QBASIC program instantly loads: [qb64.exe]/with the program file [hw.bas] already being displayed inside of the Editor Screen. Next, I only need to press function key [F5] to RUN/make that program file execute...
QBASIC Output Screen...
Hello, world!
Press any key to continue...
Find the power of a positive integer in qbasic?
PROGRAMMING LANGUAGE: QBASIC/VERSION: QB64
...Program code...
intNum% = 2
CLS
PRINT "PROGRAM: POWERS OF N/(N ="; intNum%; ")"
FOR intEachLoopNum% = 0 TO 10
PRINT intNum%; " ^ "; intEachLoopNum%; " = "; intNum% ^ intEachLoopNum%
NEXT
...Output...
2 ^ 0 = 1
2 ^ 1 = 2
2 ^ 2 = 4
2 ^ 3 = 8
2 ^ 4 = 16
2 ^ 5 = 32
2 ^ 6 = 64
2 ^ 7 = 128
2 ^ 8 = 256
2 ^ 9 = 512
2 ^ 10 = 1024
*NOTE*: In QBASIC the mathematical symbol: ^...means 'raise to the power of'; thus, 2 ^ 3; actually means raise the number 2 to the power of 3/or, 2 x 2 x 2.
How to find the sum of given 10 nos in qbasic?
10 cls
11 c = 0
20 for n =1 to 10
30 input"enter no.";a
40 c=c+a
50 next n
60 print c
IMAGINE you were a soldier fighting in the Civil War. How would you feel? Words found in level 3 questions include: Evaluating, Judging, Applying a principle, Speculationg, Imagining, Predicting, Hypothesizing.
How do you sort numbers in ascending order in Qbasic?
Cls
input"no. Of elements",n
for i=1 to n
input,a(i)
next i
for i=1 to n-1
for j=i+1 to n
if a(i)>a(j) then swap a(i),a(j)
next j
next i
for i=1 to n
print, a(i)
next i
end
How do you generate a series 1 3 5. using qbasic?
There are multiple ways to generate that particular string, several more than can be listed in one answer. For example:
CLS
PRINT "1 3 5"
or
CLS
REM An easy "1 through 5, odds only" FOR loop.
FOR X = 1 TO 5 STEP 2
PRINT X;
NEXT X
or even
CLS
INPUT "Please type in a number series with no line breaks (spaces okay):", numbers$
PRINT numbers$
What is the symbol for multiplication in QBasic?
======
FOR tablesNo%=1 TO 12
CLS
PRINT "PROGRAM: "; tablesNo%; "X Tables:-"
FOR timesNo%=1 TO 12
PRINT timesNo%; " X "; tablesNo%; " = "; timesNo%*tablesNo%
NEXT
PRINT "Press [SPACEBAR] key to continue..."
SLEEP
NEXT
END
How do you write a program in QBASIC to print the names of any 5 laptop companies?
EXAMPLE 1 - LANGUAGE: QBASIC
'*** printing string literals...
CLS
PRINT "Laptop manufacturers:-"
PRINT "Toshiba"
PRINT "Sony"
PRINT "Apple"
PRINT "Dell"
PRINT "Samsung"
END
EXAMPLE 2 - LANGUAGE: QBASIC
'*** printing string values from an array name variable...
DIM companyName$(5)
companyName$(1) = "Toshiba"
companyName$(2) = "Sony"
companyName$(3) = "Apple"
companyName$(4) = "Dell"
companyName$(5) = "Samsung"
CLS
PRINT "Laptop manufacturers:-"
FOR eachCompanyNo% = 1 TO 5
PRINT companyName$(eachCompanyNo%)
NEXT
END
EXAMPLE 3 - LANGUAGE: QBASIC
'*** READing/and, PRINTing from DATA statements list...
CLS
PRINT "Laptop manufacturers:-"
READ eachCompanyName$
DO WHILE eachCompanyName$<>"EOF"
PRINT eachCompanyName$
READ eachCompanyName$
LOOP
END
DATA "Toshiba","Sony","Apple","Dell","Samsung"
DATA "EOF"
*NOTE*: There are many more ways that it's possible to do this, too. Including...
-Storing data in an external text based file(.txt/.dat/.csv); then, opening/reading in/printing values from that external data file/closing the file.
-using fixed length strings/together with dot notation
-etc.
I will leave it up to you to go and discover how to use such further possibilities; and, more...
CONCLUSION
As you can see from the above code examples/suggestions; QBASIC, is a very highly versatile programming language; which, quite often, gives programmers multiple different ways to write their underlying 'source code'...though, each differently written program will produce exactly the same surface 'output'.
What are the words that make up a high level programming language called?
Some languages have specific terms, however keyword or reserved word is the general terminology we use when referring to a programming language's primary vocabulary. That is; words that cannot be used as identifiers. However, some languages also have contextual keywords. For instance, C++ has final and override contextual keywords. These can be used as both identifiers and keywords, depending on the context. The only reason for this is that people were using these words as identifiers before they were introduced to the language (in C++11) and making them actual keywords would have broken a lot of older code.
DIM grade(6), lowGrade(5), testName$(6), seq$(6)
seq$(1) = "first "
seq$(2) = "second"
seq$(3) = "third "
seq$(4) = "fourth"
seq$(5) = "fifth "
grLetter$ = "ABCD"
begin:
COLOR 7, 0
CLS
PRINT "Test averaging program"
PRINT "======================"
PRINT "Lets enter some basic info before we get started .."
FOR ix% = 1 TO 4
PRINT "enter a number (1-100) that you consider to be the lowest "; MID$(grLetter$, ix%, 1);
INPUT lowGrade(ix%)
PRINT STRING$(78, "-")
NEXT ix%
enterTests:
COLOR 7, 0
CLS
LINE INPUT "Enter student name or / to end program: "; name$
IF name$ = "/" THEN
CLS
END
END IF
LINE INPUT "Enter student age : "; age$
age% = VAL(age$)
PRINT STRING$(78, "=")
FOR ix% = 1 TO 5
PRINT "Enter the subject name for the "; seq$(ix%); " test: ";
LINE INPUT testName$(ix%)
LINE INPUT "Enter the grade for this test (1-100): "; grade$
grade(ix%) = VAL(grade$)
PRINT STRING$(78, "-")
NEXT ix%
CLS
displayReport:
COLOR 7, 0
CLS
GOSUB computeAverage
PRINT "Test Average Report for "; name$
PRINT "Age is "; age$
IF (age% >= 25) = 0 THEN
COLOR 6, 0
PRINT " ** Student is underage **"
END IF
COLOR 7, 0
stuGrade = average
GOSUB determineAthruF
PRINT "Test average is";
PRINT USING "###.##"; average
PRINT "This is a grade of "; grade$
IF grade$ = "F" THEN
COLOR 4, 0
PRINT "** Student did not pass **"
END IF
COLOR 7, 0
PRINT "Test Summary (those in ";
COLOR 4, 0
PRINT "red";
COLOR 7, 0
PRINT " are failing)"
FOR ix% = 1 TO 5
COLOR 7, 0
stuGrade = grade(ix%)
GOSUB determineAthruF
rptName$ = SPACE$(25)
MID$(rptName$, 1) = testName$(ix%)
IF grade$ = "F" THEN
COLOR 4, 0
END IF
PRINT rptName$, grade$,
PRINT USING "###.##"; stuGrade
NEXT ix%
COLOR 7, 0
LINE INPUT "Do you wish to average another student (Y/N) "; yn$
yn$ = UCASE$(yn$)
IF yn$ = "Y" THEN
GOTO enterTests
END IF
END
computeAverage:
total = 0
FOR ix% = 1 TO 5
total = total + grade(ix%)
NEXT ix%
average = total / 5
RETURN
determineAthruF:
IF stuGrade >= lowGrade(4) THEN
grade$ = "D"
IF stuGrade >= lowGrade(3) THEN
grade$ = "C"
IF stuGrade >= lowGrade(2) THEN
grade$ = "B"
IF stuGrade >= lowGrade(1) THEN
grade$ = "A"
END IF
END IF
END IF
ELSE
grade$ = "F"
END IF
RETURN
WAP to reverse the supplied number without using string manipulators in qbasic?
10. input number
20. let accumulator = 0
30. if number > 0 then goto 80
40. let digit = number % 10
50. let accumulator = accumulator * 10 + digit
60. let number = number / 10
70. goto 30
80. print accumulator
you could try "what will 1 1 212 1 2 3 4 n one =?" and add it up like this.:):):):):):):)
or i don't know...
1
1
1
2
3
4
+212=224
Qbasic executes programs in a which fashion?
PROCEDURAL PROGRAMMING STYLE
QBASIC uses 'procedural' programming style; which uses a 'top-down' approach; meaning each line of code will get executed in order, one after another...
Line 1, followed by...
Line 2, followed by...
Line 3,...
...and, so on...
...All the way down to line 100+...
...Or, line 1000+
-etc.
Using this 'procedural' top-down approach to programming; the programmer themselves decides exactly which part of their program code will get executed, next.
NOTE(1): QBASIC, is a FREE programming language; the latest version of which may be downloaded/and, used from here...
http://www.qb64.net
NOTE(2): Unlike OOP/Object Oriented Programming...procedural style programing does NOT use a pre-written/pre-designed library of 'objects'; therefore, if the procedural programmer wishes to use objects in their program for the end user of their program to get to interact with; then, they would have to go write their 'own' object code; which can take PLENTY of precious TIME..! This is why 'procedural' programming is, generally regarded as being an extremely 'slow' way to develop/write code.
===
The above product Visual Studio is a commercial product which you must 'buy', eventually; after your FREE trial period ends.
However, if you wish to use an entirely FREE testing/and, development version; then, you should use Visual Studio 'Express edition', instead...
http://www.microsoft.com/visualstudio/11/en-us/products/express
To write a C++ program to display the student details using class and array of
object.
Why won't QBasic work on Windows Vista?
Many DOS applications simply will not run under Windows Vista, and none under the 64-bit version. Making the NTVDM support DOS programs in Vista was an extremely low priority, since very few people actually run DOS programs anymore.
You can use QBasic and other DOS programs on Vista (even the 64-bit version) by using an emulator known as DOSBox.
What is the meaning of programmer in c language?
PROGRAMMER
The person who both designs/writes the program code is called: The programmer.
PROGRAMMING LANGUAGE
The program code itself is called: The programming language.
INTERPRETER/COMPILER
Most programming languages use 'high level' english based commands...but computers only know how to read 'low level' machine code numbers, instead.
This means that in order for such programming languages to work; then, there needs to be some form of intermediary translation program; which can translate from 'high level' english down to 'low level' machine code numbers.
Programming languages are either:
QBASIC, is an interpreted programming language.
C/C++, are both compiled programming languages
QBasic is a simple BASIC compiler that can be found on the Windows 98 Disk. Although not fancy and decorative, it is a text-based, non-visual compiler. Basic is a high-level programming language, and QBasic is just a program that compiles the programming language to binary for the computer to execute. No longer used by Microsoft.
Full form of Ms-Q-basic is Microsoft Quick Beginners All-purpose Symbolic Instruction Code
How do you draw a boat floating in river at qbasic?
You need to draw this \______/ floating on water to show a floating boat.