Weekly Qbasic and Qb64 Lesson Topics
April 20, 2024, 04:09:17 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

Sum of Metrix

Pages: [1]
  Print  
Author Topic: Sum of Metrix  (Read 287 times)
ChatKing
Post Demos
*
Posts: 23


« on: October 06, 2012, 12:08:44 pm »

Hi Friends, this is my new program which read a matrix and then total its rows and columns and overall of matrix. Here is the program

Matrix with sums
Code:
Dim Mat(3,3)
        for a = 1 to 3
            for b = 1 to 3
                read No
                TotalMat = TotalMat + No
                Mat(a,b) = No
            next b
        next a

        for a = 1 to 3
           for b = 1 to 3
                print Mat(a,b),
                sum = sum + Mat(a,b)
                if b = 3 then
                    print sum
                    print
                    sum = 0
                end if
            next b
       next a

       for b = 1 to 3
            for a = 1 to 3
                sum = sum + Mat(a,b)
                if a = 3 then
                    print sum,
                    sum = 0
                end if
            next a
        next b

        print TotalMat

        Data 1,2,2,3,2,1,5,2,9


Please comment on it, because I have used it after a long time and importantly, I have written this program in Liberty Basic neither Quick Basic nor QB64. Please try it in these and then tell me.
Report Spam   Logged

Share on Facebook Share on Twitter


Pages: [1]
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy