Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rezoanulhasan/-fbonacci-loop-php
https://github.com/rezoanulhasan/-fbonacci-loop-php
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rezoanulhasan/-fbonacci-loop-php
- Owner: RezoanulHasan
- Created: 2023-09-19T10:51:41.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-19T11:03:35.000Z (about 1 year ago)
- Last Synced: 2023-09-19T13:32:39.031Z (about 1 year ago)
- Language: PHP
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fbonacci-loop-php
## Task 1: Looping with Increment using a Function
- Write a PHP function that uses a for loop to print all even numbers from 1 to 20, but with a
step of 2. In other words, you should print 2, 4, 6, 8, 10, 12, 14, 16, 18, 20. The function
should take the arguments like start as 1, end as 20 and step as 2. You must call the
function to print.
Also do the same using while loop and do-while loop also.## Task 2: Skip Multiples of 5
- Create a PHP script that prints numbers from 1 to 50 using a for loop. However, when the
loop encounters a multiple of 5, it should skip that number using the continue statement and
continue to the next iteration.## Task 3: Break on Condition
- Write a PHP program that calculates and prints the first 10 Fibonacci numbers. But, if a
Fibonacci number is greater than 100, break out of the loop using the break statement.## Task 4: Fibonacci Series printing using a Function
- Write a PHP function to print the first 15 numbers in the Fibonacci series. You should take
this 15 as an argument of a function and use a for loop to generate these numbers and print
them by calling the function.