Thread: Array question

  1. #1
    Registered User
    Join Date
    May 2011
    Location
    Ireland
    Posts
    13

    Question Array question

    Code:
    consider the following:
    int [] numbers1 = {1,3,6,9};
    int [] numbers1 = {2,4,6,8};
    int result;
    int total;
    
    using a for statement write code that multiplies each element of numbers1 array by its corresponding element in numbers2 array and assigns the result to the result variable and accumilates each result in the total variable.
    Could someone explain and do this question plz!

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Quote Originally Posted by Markusob View Post
    Could someone explain and do this question plz!
    No, we will not do your homework for you.
    bit∙hub [bit-huhb] n. A source and destination for information.

  3. #3
    Registered User
    Join Date
    May 2011
    Location
    Ireland
    Posts
    13
    Not homework my friend..

    Im studying for an exam an need a little help for revision is all.

  4. #4
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    I'm not going to go as far as saying that I don't believe you, but... revision my ass. You're asking someone to explain and do something for you. Put forth some effort and ask questions about specific problems. Not "here's something that obviously looks like a homework problem that I'm too lazy to do."
    If you understand what you're doing, you're not learning anything.

  5. #5
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    If that is an exact copy and paste of the question then you need to slap your teacher for having both arrays named 'numbers1' in the code that has been prepared for you. No wonder you are struggling.

    Code:
    int [] numbers1 = {1, 3, 6, 9};
    int [] numbers2 = {2, 4, 6, 8};
    int result;
    int total;
    Have a go at this problem, post your attempt, and we will help guide you to the correct answer.

  6. #6
    Registered User
    Join Date
    Jun 2003
    Posts
    129
    Can someone sort this guy out? This isn't exam level programming by any means, this was pop-quiz stuff at the end of a session at my university.

    theoobe, I am more inclined to believe it's his typing rather than copy-paste.

    OP, can you make a flowchart? Make a flowchart, realise exactly how easy this stuff is.
    He who asks is a fool for five minutes, but he who does not ask remains a fool forever.

    The fool wonders, the wise man asks. - Benjamin Disraeli

    There are no foolish questions and no man becomes a fool until he has stopped asking questions. Charles Steinmetz

  7. #7
    Registered User
    Join Date
    May 2011
    Location
    Ireland
    Posts
    13
    I just asked a simple question... its the type of stuff thats coming up on the exam so if you dont want to help just stop commenting!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 12
    Last Post: 11-21-2010, 09:46 AM
  2. array question
    By skiabox in forum C Programming
    Replies: 3
    Last Post: 11-21-2010, 09:44 AM
  3. Array question
    By 182 in forum C++ Programming
    Replies: 3
    Last Post: 05-05-2006, 11:46 PM
  4. Array question
    By Karmachrome in forum C Programming
    Replies: 4
    Last Post: 10-27-2005, 09:33 PM
  5. Array question
    By WolfPack in forum C Programming
    Replies: 0
    Last Post: 12-11-2002, 03:50 PM