I have to print a while statement odd numbers between 1 - 49 then change it to a for statement and this is what I got so far!
Can't figure out the rest...........
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>Odd Numbers</title>
</head>
<body>
<?php // Script 6.2 - Odd Numbers
// Address error handling.
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
/*Odd Numbers */
// Validate the Odd Numbers.
$i = 1;
$i < 1 && $i => 49 {
echo $i++;
// Print out odd numbers between 1-49.
for($i = 0;$i < 50;++$i) {
if($i % 2) {
echo "$i is odd!<br />\n";
}
}
?>
</body>
</html>
A while statement to a for statement - confused!
Moderator: General Moderators
-
canadian_angel
- Forum Commoner
- Posts: 31
- Joined: Fri Jun 11, 2010 3:13 pm
- andyhoneycutt
- Forum Contributor
- Posts: 468
- Joined: Wed Aug 27, 2008 10:02 am
- Location: Idaho Falls
Re: A while statement to a for statement - confused!
No need to re-address us with this. You've already submitted this here: viewtopic.php?f=1&t=117506&p=611304#p611304
That said, it already appears that you accepted the answer you were given...why the resubmit?
That said, it already appears that you accepted the answer you were given...why the resubmit?
-
canadian_angel
- Forum Commoner
- Posts: 31
- Joined: Fri Jun 11, 2010 3:13 pm