Computer Science, asked by sheikhrehan08727, 2 months ago

2.Write QBASIC program to print first five odd numbers.​

Answers

Answered by arth696
3

Answer:

1 for i = 1 to 5

2. print 1 * 2

3. next i

This works in QB64, which is a modern version of QBasic

Hope it helps. : )

Answered by BrainlyYoda
1

Write QBASIC program to print the first five odd numbers.​

FOR I = 1 TO 10 STEP 2

PRINT I

NEXT I

Output

1

3

5

7

9

Explanation

FOR is a loop that is iterating values from 1 to 10 and STEP is used to increment or decrement the looping value whenever the loop is executed.

Extra Information

1) Write a program in QBASIC to print your name 5 times.

PRINT  "Enter your Name"

INPUT  NAME$

FOR i = 1 TO 4

PRINT NAME$

NEXT i

2) Write a program in QBASIC to add 10 and 20.

SUM = 10 + 20

PRINT "The sum is:", SUM

3) Program to input two numbers and find their Sum, Subtraction, Multiplication, and Average

REM "Program to input two numbers and find their Sum, Subtraction, Multiplication, and Average"

PRINT  "Enter first number"

INPUT  NUMBER1

PRINT  "Enter second number"

INPUT  NUMBER2

SUM = NUMBER1 + NUMBER2

SUBTRACTION = NUMBER1 - NUMBER2

MULTIPLICATION = NUMBER1 * NUMBER2

AVERAGE = (NUMBER1 + NUMBER2) / 2

PRINT "The sum is:", SUM

PRINT "The subtraction is:", SUBTRACTION

PRINT "The multiplication is:", MULTIPLICATION

PRINT "The average is:", AVERAGE

REM is used for adding remarks you can remove that while running QBasic Program

Similar questions