BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan Right Header

HOME BZU Mail Box Online Games Radio and TV Cricket All Albums
Go Back   BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan > Institute of Computing > Bachelor of Science in Information Technology > BsIT 5th Semester > Visual Programming

Visual Programming Sir Ahsan


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 06-12-2009, 06:08 PM
shmsa's Avatar
Grown up punk

 
Join Date: Oct 2007
Location: Muslim Town Multan
Posts: 195
Contact Number: 0322-6196713
Program / Discipline: BSIT
Class Roll Number: 07-22
shmsa is a jewel in the roughshmsa is a jewel in the roughshmsa is a jewel in the roughshmsa is a jewel in the rough
lectures Q3:Jagged Array of 3 rows

create a jagged array of three rows, create different length of rows and show the sum of elements of each row.
Code:
Module jaggedArray

    Sub Main()
        Dim ar1 As Integer()()
        ar1 = New Integer(2)() {}
        ar1(0) = New Integer(2) {1, 2, 3}
        ar1(1) = New Integer(1) {4, 5}
        ar1(2) = New Integer(0) {6}

        Dim i, j, sum As Integer
        For i = 0 To ar1.GetUpperBound(0)
            For j = 0 To ar1(i).GetUpperBound(0)
                Console.Write(ar1(i)(j) & vbTab)
            Next
            Console.Write(vbCrLf)
        Next

        For i = 0 To 2
            sum = 0
            For j = 0 To ar1(i).GetUpperBound(0)
                sum = ar1(i)(j) + sum
            Next

            Console.Write(sum & vbCrLf)
        Next
    End Sub

End Module

Reply With Quote
Reply

Tags
array, q3jagged, rows


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array program in C sharp thecool Visual Programming 0 17-06-2011 08:59 PM
Program to enter 10 integers in a single-dimension array and then print out the array in ascending order bonfire Object Oriented Programming 0 09-03-2011 12:23 AM
Lesson 8: Array basics bonfire Introduction to Computing 0 26-02-2011 10:30 PM
Multiplication of Array in OOPs Muhammad Sohail Akhtar Tutorial 0 26-06-2008 11:47 PM
[PHP] Multidimensional Array BSIT07-01 Tutorial 2 14-06-2008 02:15 AM

Best view in Firefox
Almuslimeen.info | BZU Multan | Dedicated server hosting
Note: All trademarks and copyrights held by respective owners. We will take action against any copyright violation if it is proved to us.

All times are GMT +5. The time now is 12:12 AM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.