Hi i need to Echo out this statement,
Starting weight is: 180 Starting body fat is: 15%
After losing 1 pounds of fat Weight is now 179 body fat is now: 14.53%
After losing 2 pounds of fat Weight is now 178 body fat is now: 14.04%
After losing 3 pounds of fat Weight is now 177 body fat is now: 13.56%
After losing 4 pounds of fat Weight is now 176 body fat is now: 13.07%
After losing 5 pounds of fat Weight is now 175 body fat is now: 12.57%
After losing 6 pounds of fat Weight is now 174 body fat is now: 12.07%
So this is what I have, im not sure how to subtract 1 pound to output 179 and so forth, any help and advice would be appreciated.
[php]<?php
$start_weight = 180;
$start_body_fat = 27;
$start_body_fat_percent = $start_body_fat/$start_weight * 100;
$pounds_lost = 15;
echo “Starting weight is: “.$start_weight.” Starting body fat is: “.$start_body_fat_percent.”%”;
for($i = 1; $i <= $pounds_lost; $i++)
{
//work out new body weight, take $i from $body_weight*/
$new_weight = $i-$pounds_lost
//recalculate body fat percentage, take $i from $start_body_fat and divide by new body weight and times by 100
$new_body_fat_percent = $i-$start_body_fat/$new_weight *100;
// output how many pounds lost ($i), new weight and body fat percentage
echo "After losing $i pounds of fat weight is now: $new_weight, body fat is: $new_body_fat_percent%";
}
?>[/php]
Thank you.