# QBasic help....

#### RUDY03

##### Senior Member
I'm pretty new to QBasic, and I have missed the classes in school concerning

a) PRINT TAB
b) END IF commands.

I shall be very very grateful indeed, if someone would please urgently clear my doubts, by putting in the syntax of both commands separately and using example programs.

P.S. I use QB64 for practice purposes at home.

PRINT TAB(#) moves the text over # number of columns where X is an integer. If it exceeds the width of a row it will wrap to the next row.

END IF simply ends an IF statement

IF <condition> Then
<execute some code>

END IF

Hey friends!
My exams are near, and I need serious help in BASIC programming...

Question:
1) WAP in BASIC to input 50 numbers. Display sum of all even numbers among given set of numbers.

2) WAP in BASIC to find the sum of negative odd numbers and product of positive even numbers separately in a set of 100 numbers entered by an user.

3)In a class the teacher wants to calculate average marks of 45 students. WAP to input 45 marks and calculate average marks.

4)Write a program in BASIC to print:​

(a)
INDIA
INDI
IND​
IN
I

(b)
A
I
D
N
I
5) WAP to enter sentence in upper-case. Count no. of vowels in the sentence.

That's all for now.......

Now obviously they want us to use FOR-NEXT loops....otherwise it could have been much easier as well as much longer.....

I really don't know how to do calculations based on the results of many loops taken together....​

Last edited:

1
• Loop until false (on input) read in number from user and store it in an array
• Then have a for next loop 0 to < array size. If number mod 2 is 0 add number to sum
2
• Loop until false (on input) read in number from user and store it in an array
• If number < 0 add it to sum of negative numbers
• if number mod 2 equals 0 take the product of number
3
• Loop until false (on input) read in number from user and store it in an array
• Add up numbers and divide by how many numbers you have
4
• a) Use a for next loop that starts at 5 and step -1 and use the LEFT function to print
• b) A string is an array, so just use a for next loop and print each char using the step variable in the loop
5
• Use two nested for next loops the first loop steps through each letter in the sentence
• The inner loop loops through an array with vowels and checks the current letter in the sentence for a match

Me too looking for this same stuff. Thanks for discussing this matter

v

QBasic is a subset of QuickBasic version 4.5. The QBasic online help feature contains complete articles explaining version differences between BASICA/GW-BASIC and QBasic, unsupported keywords, and converting BASICA programs for use under QBasic. QBasic provides a "Windows-like" environment supporting the use of a mouse. A menu bar across the top of the screen contains pull-down menu selections.