Add up to five · Jumlahkan hingga lima
Add up to five
Use a while loop to add 1 + 2 + 3 + 4 + 5 into total. total should end as 15.
Two things change every time round: the running total, and the counter n. Miss the counter and the loop never ends; miss the total and it ends with nothing in it.
Jumlahkan hingga lima
Gunakan loop while untuk menjumlahkan 1 + 2 + 3 + 4 + 5 ke dalam total. total seharusnya berakhir sebagai 15.
Dua hal berubah setiap putaran: total berjalan total, dan penanda n. Melewatkan penanda membuat loop tak berujung; melewatkan total membuatnya berakhir dengan kosong.
Use a while loop to add 1 + 2 + 3 + 4 + 5 into total. total should end as 15. · Gunakan loop while untuk menjumlahkan 1 + 2 + 3 + 4 + 5 ke dalam total. total seharusnya berakhir sebagai 15.
Click Run to see the output here. · Klik Jalankan untuk melihat output di sini.