Challenge: Array With Powers of Two
Compito
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.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 3
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Fantastico!
Completion tasso migliorato a 7.69
Challenge: Array With Powers of Two
Scorri per mostrare il menu
Compito
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.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 3
single