Tuesday, 23 September 2014

Example of a two dimensional array using basic program (QBASIC)

This is a sample on writing two dimensional array with Qbasic its kind of easy all you just need is to understand how it works.

here is the code:

DIM vars(2, 2) AS INTEGER
vars(1, 1) = 1
vars(1, 2) = 1
 vars(2, 1) = 2 
vars(2, 2) = 2
FOR y = 1 to 2
    FOR x = 1 to 2
        PRINT vars(y,x),
    NEXT x

The first line declares the type of array you want to make like in this case, its a 2 x 2 array.
The second line to the forth line initializes the array. i.e it gives value to the array the the last lines print the arrays to the screen.
Please feel free to comment and like our page on facebook


  1. you can ask questions if you don't understand any line of code. Thanks

  2. 1.wap to read names and total marks of 10 students.print names and marks for all those students who have scored greater than or equal to 450?
    2. wap to input serial number,name and marks in 5 different subject of any 10 students and print the name and marks of highest scorer.
    3.wap to read name and mobile number of any 10 students from given data statement.ask the user to input a name and print his/her mobile number.
    I need these question's answer ASAP can you help me through out this ?? ASAP