Results 1 to 2 of 2
  1. #1
    Javanoobs is offline Member
    Join Date
    Feb 2011
    Posts
    18
    Rep Power
    0

    Default 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... :)

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,438
    Blog Entries
    7
    Rep Power
    20

    Default

    There is nothing advanced about this question; it doesn't belong in this group and please don't post your question in multiple forum groups; I answered it already in the 'New to Java' forum group.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Program in Java To calculate GCD of n numbers.?
    By ankitsinghal_89 in forum New To Java
    Replies: 4
    Last Post: 02-15-2011, 09:23 AM
  2. 2 dimensional array help!
    By ber1023 in forum New To Java
    Replies: 9
    Last Post: 01-02-2011, 12:29 AM
  3. Replies: 1
    Last Post: 04-27-2010, 11:29 PM
  4. Multi-dimensional array program-help!
    By bobmasta5 in forum New To Java
    Replies: 13
    Last Post: 03-15-2009, 07:21 PM
  5. Why my program cannot calculate the decimal value?
    By pearllymary78 in forum New To Java
    Replies: 4
    Last Post: 06-23-2008, 12:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •