Challenge: Array With Powers of Two
Aufgabe
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.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 1. Kapitel 3
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Großartig!
Completion Rate verbessert auf 7.69
Challenge: Array With Powers of Two
Swipe um das Menü anzuzeigen
Aufgabe
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.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 1. Kapitel 3
single