Wednesday, November 3, 2021

Q-basic programs (To Find name, odd, even, series, multiplication table, divisible, a sum of even or odd numbers)

Q-basic programs (To Find name, odd, even, series, multiplication table, divisible, a sum of even or odd numbers)

1. How do you write a flowchart and QBasic code to generate series 5, 10, 15, 20, up to 10 terms?

CLS
A=5
FOR I = 1 TO 10
PRINT A;
A=A+5 
NEXT I 
END

2. How do you write a program in QBasic to write a table of 1 to 10 number
CLS
FOR I = 1 TO 10
FOR J = 1 TO 10
PRINT J ;"*"; I ;"="; (J*I)
NEXT J
NEXT I
END

3. How do I write a QBASIC program for multiples of 9?
CLS
A =9
FOR I = 1 TO 10 
PRINT A; "*";I; "="; ( A*I)
NEXT I 
END

4. WAP To print my school name 100 times?

CLS
A$ = "ENTER YOUR SCHOOL NAME"
FOR I =1 TO 100
PRINT A$ 
NEXT I 
END

5. WAP To print my name 20 times?

CLS
A$ = "ENTER YOUR NAME"
FOR I =1 TO 100
PRINT A$ 
NEXT I 
END

6. How do you write a QBasic program to check whether a number is exactly divisible by 3 or 7?

CLS 
INPUT ''ENTER A NUMBER"; N
IF N MOD 3 = 0 AND N MOD 7 = 0 THEN
PRINT "THE NUMBER IS DIVISIBLE BY 3 OR 7"
ELSE 
PRINT ''THE NUMBER IS NOT DIVISIBLE BY 3 OR 7"
ENDIF

END


No comments:

Post a Comment

Sharkey

Simple way to make website using HTML only.

 A simple way to make a website using HTML only. <!DOCTYPE html> <head>         <title>Document</title> </head...