View Full Version : Arrays
07-05-2006, 11:46 AM
sorry this is such a basic question -
I have an array of 10 numbers, i need to print the first number and then add the second number and print the total, i then need add the 3rd number and print the total - etc until the end of the ten numbers -
eg 1 1
thanks for any ideas -
07-05-2006, 01:02 PM
Hi there johnr100,
and a warm welcome to these forums. ;)
does this help...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
border:1px solid #000;
var nums=new Array(1,2,3,4,5,6,7,8,9,10);
document.getElementById('numbers').innerHTML+=nums[c]+'. '+temp+'<br />';
07-05-2006, 07:50 PM
I am sure that johnr100's teacher will be most impressed at the spped at which he has leaned such sophistication! But sadly if he simply copies other peoples' work he will never learn, and in future every time he gets the answer right the teacher will suspect that he has cheated. In the long run it is unhelpful and counter-productive to do students' homework for them.
07-05-2006, 08:10 PM
Hi there Philip,
you will probably tell me that I am obtuse but how do you differentiate between students and non students. :confused:
I can only see people with problems. ;)
07-05-2006, 10:42 PM
"If you fish for a man you feed him for a day. If you teach him to fish you feed him for life." (I can't remember who said that but it is very relevant).
If you teach people how to write the code themselves instead of writing it for them then it doesn't matter whether the person is a student or not.
07-05-2006, 11:05 PM
Hi there felgall,
'He who can, does. He who cannot teaches'
George Bernard Shaw
I am only here to try and solve problems. If this is right or wrong, it is not for me to say.
I will leave that to those with the problems. :D
07-06-2006, 10:58 AM
“Give a man a fish; you have fed him for today. Teach a man to fish; and you will not have to listen to his incessant whining about how hungry he is.”—Author unknown
“Give a man a fish; you have fed him for today. Teach a man to fish; and you can sell him fishing equipment.”—Author unknown
“Give a man a fish; you have fed him for today. Teach a man to use the Internet and he won't bother you for weeks.”—Author unknown
“Teach a man to fish and you feed him for a lifetime. Unless he doesn't like sushi—then you also have to teach him to cook.”—Auren Hoffman, Herald Philosopher
“Give a man a fish; you have fed him for today. Teach a man to fish, and he will sit in the boat and drink beer all day.”—OldFox
“Give a man a fish; you have fed him for today. Teach a man to fish; and you have fed him for a lifetime. Teach a man to sell fish and he eats steak.”—Author unknown
Coothead - I see you are in Chertsey, which is not a thousand miles away from me.
07-06-2006, 11:21 AM
Hi there Philip,
... I see you are in Chertsey, which is not a thousand miles away from me.
Oh my gosh, I hope that does not mean that, I will be getting the 'middle of the night bang on the door'. :eek:
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.