hereisgoes Posted March 1, 2012 Share Posted March 1, 2012 Hi guys. I am new here but have been following the board for about a month. I will try to contribute as much as possible. I was given a problem, and need some help out with it. Most of you will probably find it pretty simple. Here is what I have: ?> //Rewrite the while loop using a for loop. for echo "8 times $num is: " . ($num*. "<br/>" } /* For the output I need: 8 times 1 is:8 8 times 2 is:16 8 times 3 is: 24 8 times 4 is:32 8 times 5 is:40 8 times 6 is: 48 8 times 7 is: 56 8 times 8 is:64 8 times 9 is: 72 8 times 10 is: 80 */ ?> So basically I need to fill in that missing code(rewrite the while loop using a for loop) Thank you so much in advance! Link to comment https://forums.phpfreaks.com/topic/258058-conditionalstatement-while-loop-question/ Share on other sites More sharing options...
hereisgoes Posted March 1, 2012 Author Share Posted March 1, 2012 The is supposed to be is: Link to comment https://forums.phpfreaks.com/topic/258058-conditionalstatement-while-loop-question/#findComment-1322812 Share on other sites More sharing options...
litebearer Posted March 1, 2012 Share Posted March 1, 2012 Perhaps... <?PHP for($i=1;$i<9;$i++) { echo "8 x " . $i . " is " . $i*8 . "<br />"; } ?> Link to comment https://forums.phpfreaks.com/topic/258058-conditionalstatement-while-loop-question/#findComment-1322840 Share on other sites More sharing options...
hereisgoes Posted March 1, 2012 Author Share Posted March 1, 2012 Awesome! Thank you so much, is there a way to mark this as solved. Link to comment https://forums.phpfreaks.com/topic/258058-conditionalstatement-while-loop-question/#findComment-1322846 Share on other sites More sharing options...
kicken Posted March 1, 2012 Share Posted March 1, 2012 Awesome! Thank you so much, is there a way to mark this as solved. There is a 'Topic Solved' button at the bottom of the thread you can click to mark it as solved. Link to comment https://forums.phpfreaks.com/topic/258058-conditionalstatement-while-loop-question/#findComment-1322851 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.