Challenge: Array With Powers of Two
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 3
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Incrível!
Completion taxa melhorada para 7.69
Challenge: Array With Powers of Two
Deslize para mostrar o menu
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 3
single