Quotes help make search much faster. Example: "Practice Makes Perfect"

Saturday, January 5, 2013

Math Problems: 2x + 3y = 100



How many ordered pairs (x, y) will satisfy the equation 2x + 3y = 100?

Answer: 17

The sum being 100 implies that x is less than or equal to 50 and y is less than 34 which accounts for the values in the loops below.

Solve using the following script:

for(var x=0; x<=50; x++){
 for(var y=0; y<34; y++){
  if(2*x+3*y==100){
   console.log("x: "+x+" y: "+y);
  }
 }
}

1 comment:

  1. Please take down this post

    -Calvin Lin
    Brilliant Mathematics Challenge Master

    ReplyDelete


This is an example of scrolling text using Javascript.

Popular Posts