Challenge: Array With Powers of Two
Tâche
Swipe to start coding
Write a function that fills an integer array with powers of two. The first element should be 1 (2⁰), the second 2 (2¹), the third 4 (2²), and so on.
- Declare the array in
mainwith a fixed size of 8. - Do not initialize the array when you declare it in
main. - Complete the function
fillPowersOfTwoso that it fills the array with powers of two, starting from 1. - Use a loop inside the function to fill the array.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 1. Chapitre 3
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Génial!
Completion taux amélioré à 7.69
Challenge: Array With Powers of Two
Glissez pour afficher le menu
Tâche
Swipe to start coding
Write a function that fills an integer array with powers of two. The first element should be 1 (2⁰), the second 2 (2¹), the third 4 (2²), and so on.
- Declare the array in
mainwith a fixed size of 8. - Do not initialize the array when you declare it in
main. - Complete the function
fillPowersOfTwoso that it fills the array with powers of two, starting from 1. - Use a loop inside the function to fill the array.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 1. Chapitre 3
single