Joe Forsythe wrote: > Hmmm... These all seem like pretty basic programming class > questions... Trying to get someone to do your homework for you? > > How about you send your code for the 3 problems and we'll help you > debug it. > -- > Joe > > On Jun 17, 2009, at 7:06 PM, Ella Mae Luyun wrote: >> what is the syntax/ code to this problems: >> 1) 2, 4, 6, 8, 10 >> >> 2) 2006 is not a leap year >> 2008 is a leap year >> >> 3) if you input, age is 18 then the output should be "your a >> debutant" >> if you input, age is 17 then the output should be "your a >> minor" >> if you input, age is 25 then the output should be "your an >> adult" Give the guy a break. This should get him full marks... echo "Question 1\n"; for ($i = ','; substr($i, strlen($i)-1) !== '9'; $i .= '2'.strlen($i)) { echo strlen('2'.$i).substr($i, 0,1); } echo "\n"; echo "Question 2\n"; $date = 2006; function leapyear($year) { return chr(77+11* ((intval($year.'.9.9.9.9.9.9', 9.9) % 9) >> 2 -1)); } if (leapyear(2006) == 'n') print "2006 is not a leap year\n"; if (leapyear(2008) == 'y') print "2008 is a leap year\n"; echo "Question 3\n"; function age($age) { $a=array('debutant','minor','adult'); print "your an ".$a[2-intval(chr((1<<5) + $age),5)]."\n"; } age(18); age(17); age(25); Here's the results: Question 1 2,4,6,8,10, Question 2 2006 is not a leap year 2008 is a leap year Question 3 your an debutant your an minor your an adult