Question
Hi All, I need some help figuring out my PHP coding homework, it's been a hard week with full-time school and work. I appreciate the
Hi All,
I need some help figuring out my PHP coding homework, it's been a hard week with full-time school and work. I appreciate the assistance/
Each of these problems can be solved with only a few lines of PHP code, but don't be fooled into thinking they are simple problems! Don't bang your head against the wall trying to figure them out! There are a number of different solutions to both problems. Feel free to ask for help and share solutions in the discussion forum.
- Using the printf() function, write a single line of code that takes a month (from 1 to 12), a day (from 1 to 31), and a four-digit year, and displays the resulting date, formatted in mm/dd/yyyy format. Don't forget to add a zero in front of the month or day if it's less than 10.
- A factorial of any given integer, n, is the product of all positive integers between 1 and n inclusive. So the factorial of 4 is 1 2 3 4 = 24, and the factorial of 5 is 1 2 3 4 5 = 120. This can be expressed recursively as follows:
1. If n == 0, return 1. (This is the base case)
2. If n > 0, compute the factorial of n1, multiply it by n, and return the result
Write a PHP script that uses a recursive function to display the factorials of the integers 0 to 10.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started