Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Print a Sequence | PHP Loops: for, while, foreach
Practice
Projects
Quizzes & Challenges
Quiz
Challenges
/
PHP Loops & Iteration

bookChallenge: Print a Sequence

Tâche

Swipe to start coding

Write a PHP function that prints all even numbers from 2 to 20, each on a new line.

  • Use a for loop to generate numbers from 2 to 20.
  • Check that each number is even.
  • Print each even number on a new line.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 2
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

bookChallenge: Print a Sequence

Glissez pour afficher le menu

Tâche

Swipe to start coding

Write a PHP function that prints all even numbers from 2 to 20, each on a new line.

  • Use a for loop to generate numbers from 2 to 20.
  • Check that each number is even.
  • Print each even number on a new line.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 2
single

single

some-alt