Challenge: Array With Powers of Two
Завдання
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.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 3
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Чудово!
Completion показник покращився до 7.69
Challenge: Array With Powers of Two
Свайпніть щоб показати меню
Завдання
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.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 3
single