Results 1 to 2 of 2
- 02-08-2011, 06:38 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 18
- Rep Power
- 0
How to write a program to calculate and display sum in two dimensional array
I have a college tutorial question that required me to write a program which need to calculate and display the sum of each column of a two dimensional array. For example, in the following array
2 6 -1 5
8 2 7 -5
1 0 4 4
the method shoudl display the following
The sum of column 0 is 11
The sum of column 1 is 8
The sum of column 2 is 10
The sum of column 3 is 4
Assume that in the calling program the array A is declared as float A[MAXROW][MAXCOL]; where MAXROW and MAXCOL are global int constants.
The method should have a two dimensional array as its only parameter and shold not return any values.
I have roughly wrote something on a paper, but i jst dun get the idea how to link all the tings 2gether, can anyone pls help me of this? somone jst try to write tis program and giv me example wil do... :)
- 02-08-2011, 09:11 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
Program in Java To calculate GCD of n numbers.?
By ankitsinghal_89 in forum New To JavaReplies: 4Last Post: 02-15-2011, 09:23 AM -
2 dimensional array help!
By ber1023 in forum New To JavaReplies: 9Last Post: 01-02-2011, 12:29 AM -
Java application to calculate and display the cost of a number of tickets according
By herberwz in forum New To JavaReplies: 1Last Post: 04-27-2010, 11:29 PM -
Multi-dimensional array program-help!
By bobmasta5 in forum New To JavaReplies: 13Last Post: 03-15-2009, 07:21 PM -
Why my program cannot calculate the decimal value?
By pearllymary78 in forum New To JavaReplies: 4Last Post: 06-23-2008, 12:52 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks