Секція 1. Розділ 38
single
Challenge: for Loop
Свайпніть щоб показати меню
Завдання
Проведіть, щоб почати кодувати
Imagine you are buying several items in a shop. Each item costs the same amount, and you want to calculate the total cost of all items.
- Initialize
totalCostto0. - The loop should start with
i = 0and run whilei < quantity. - Add
itemPricetototalCostinside the loop. - Return
totalCostat the end of the method.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 38
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат