Challenge: Print Odd Numbers
Oppgave
Swipe to start coding
Write a program that prints all odd numbers from 1 to 20 using a for loop with a custom step.
- Use a for loop to iterate through numbers starting at 1 and ending before 20.
- Set the step value in the loop so that only odd numbers are processed.
- Print each odd number on a new line.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 2
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Awesome!
Completion rate improved to 5.56
Challenge: Print Odd Numbers
Sveip for å vise menyen
Oppgave
Swipe to start coding
Write a program that prints all odd numbers from 1 to 20 using a for loop with a custom step.
- Use a for loop to iterate through numbers starting at 1 and ending before 20.
- Set the step value in the loop so that only odd numbers are processed.
- Print each odd number on a new line.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 2
single