10 CLS
20 FOR n = 1 to 10
30 PRINT n, n^2, n^3
40 NEXT n
50 PRINT: PRINT: PRINT "Touch 'x' to go again, any other key to end."
60 INPUT a$
70 IF a$ = "X" or a$ = "x" THEN 10
80 END
Here is a sample QBasic program to print the squares and cubes of the first 10 natural numbers:
FOR i = 1 TO 10
PRINT "Number: ", i
PRINT "Square: ", i * i
PRINT "Cube: ", i * i * i
NEXT i
This program uses a FOR loop to iterate through the first 10 natural numbers and calculates and prints their squares and cubes accordingly.
you do this 10 print "0112358132134" use the whole of the thing
Statement numbers were a feature of BASIC, and while QBASIC supports them, they are by no means necessary.
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!
Give your numbers the names 'A' and 'B', and use these program lines. Whichever of the two numbers is greater will be printed. G = A If B > A THEN G = B. PRINT "The greater number is "; G
You use the relevant formula.
(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.
Cls input "enter two no.s ",a,b sum=a+b print "sum = ";sum end
Write a program that calculates the area of a triangle in QBASIC
a triangle then a square :)
H. Tornsdorf has written: 'Windows 3.1 - Trucos y Consejos' 'QBasic for beginners' -- subject(s): QBasic (Computer program language)
You need a code that can run to print even numbers between 10 and 100 using the qbasic command.
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.