Jump to content

This is a impossible return


Shadowing

Recommended Posts

Hey guys im having a problem. This is crazy makes no sense at all.

I am so stuck and out of answers on why this is happening

 

 

I wrote this code out so anyone can just copy and paste it to see results

 

 


           $resource1_level_costs = 0; 
           $resource1_highest_level = 2 + 1;
           $resource1_subtract = 50; 
           $before_bonus_reduction = '';


while($resource1_level_costs < $resource1_subtract)   { 

             $before_bonus_reduction = pow($resource1_highest_level,3); 
             $resource1_level_costs += ceil($before_bonus_reduction - ($before_bonus_reduction * .22)); 								
             $resource1_subtract -= $resource1_level_costs; 

++$resource1_highest_level;

  
echo $before_bonus_reduction." before deduction<br />";				
echo $resource1_level_costs." after deduction<br />";


}

 

 

 

 

The return is this

 

27 before deduction

22 after deduction

64 before deduction

72 after deduction

 

 

takes 27 subtracts 22 percent giving 22

 

takes 64 subtracts 22 percent giving 72????? what the heck

Link to comment
https://forums.phpfreaks.com/topic/264338-this-is-a-impossible-return/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.