78 439
Assignments Done
Successfully Done
In September 2019

Answer to Question #25739 in C++ for Bronue-

Question #25739
Write php code that will calculate and print the sum of all numbers less than 100. If the sum is even, print “even” to the web page; otherwise, print “odd”.
Expert's answer


echo "The total was ", $sum," which is ";

if ($sum%2==0){
echo "even";}

if ($sum%2==1){
echo "odd";}


The second If check is redundant because if a number is not even it is going to be odd so you could use:

if ($sum%2==0){
echo "even";}

echo "odd";}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions