Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Print a Sequence | PHP Loops: for, while, foreach
PHP Loops & Iteration

bookChallenge: Print a Sequence

Tehtävä

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.

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 2
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

close

bookChallenge: Print a Sequence

Pyyhkäise näyttääksesi valikon

Tehtävä

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.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 2
single

single

some-alt