Results 1 to 11 of 11
Thread: need help with multiplication
- 03-06-2011, 05:46 PM #1
Member
- Join Date
- Mar 2011
- Posts
- 5
- Rep Power
- 0
- 03-06-2011, 05:56 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,605
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-06-2011, 06:19 PM #3
Member
- Join Date
- Mar 2011
- Posts
- 5
- Rep Power
- 0
here is my code so far
var y = 1;
var x = 5;
for (y=1; y<11; y = y + 1){
sum = y * x;
document.write("<li>")
document.write ( y + " x " + x + " = " + sum + "<br>");
}
- 03-06-2011, 06:22 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,605
- Blog Entries
- 7
- Rep Power
- 17
- 03-06-2011, 06:40 PM #5
Member
- Join Date
- Mar 2011
- Posts
- 5
- Rep Power
- 0
I'm having trouble with writing the loop.
Thanks for your help. I will post my question in a javascript forum.
- 03-06-2011, 07:05 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,605
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-06-2011, 08:42 PM #7
Member
- Join Date
- Mar 2011
- Posts
- 5
- Rep Power
- 0
Jos,
Thanks that worked. :)
- 03-08-2011, 02:00 AM #8
Member
- Join Date
- Mar 2011
- Posts
- 5
- Rep Power
- 0
Can you help me with this? I know its not javascript. I'm trying to write this code.
function sumThese() {
var sumEven=0, sum5=0;
for(i=0; i<100; i++) {
sumEven = (i % 2 == 0) ? parseInt(sumEven+i) : sumEven ; // if value of i modulus 2 is 0, gets all even numbers
sum5 = (i % 5 == 0) ? parseInt(sum5+i) : sum5 ; // if value of i modulus 5 is 0, gets all multiples of 5
}
alert("sumEven = " + sumEven + ", and sum5 = " + sum5);
}
- 03-08-2011, 02:05 AM #9
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Please make another thread, don't hijack old solved posts. When/if you make a new thread, please be sure to actually provide a concrete, detailed question.
- 03-08-2011, 03:37 AM #10
Actually, it's not a hijack. It's the same OP back with another JavaScript question.
@dakid2: Please find a JavaScript forum, this isn't one.
db
- 03-08-2011, 03:41 AM #11
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Similar Threads
-
Multiplication Table
By BillyB in forum New To JavaReplies: 17Last Post: 12-24-2010, 06:58 AM -
need help with this: multiplication table
By MsIceCold in forum New To JavaReplies: 7Last Post: 07-13-2010, 01:31 PM -
Problem regarding multiplication
By javanewbie1234 in forum New To JavaReplies: 1Last Post: 03-10-2010, 09:27 AM -
Help with Multiplication
By phil028 in forum New To JavaReplies: 1Last Post: 12-06-2007, 07:39 PM -
Help with multiplication table
By Albert in forum New To JavaReplies: 1Last Post: 07-10-2007, 04:44 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks