Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: do-while Loop | Loops
C# Basics

bookChallenge: do-while Loop

Task

Swipe to start coding

In this task, you will practice using a do-while loop to simulate a real-life scenario: saving money daily until reaching a target amount.

  • Inside the CalculateSavings method:
    • Initialize totalSaved to 0.
    • Initialize days to 0.
    • Use a do-while loop to:
      • Add dailySaving to totalSaved each day.
      • Increment days by 1.
      • Repeat the loop until totalSaved is greater than or equal to targetAmount.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 4. ChapterΒ 5
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

bookChallenge: do-while Loop

Swipe to show menu

Task

Swipe to start coding

In this task, you will practice using a do-while loop to simulate a real-life scenario: saving money daily until reaching a target amount.

  • Inside the CalculateSavings method:
    • Initialize totalSaved to 0.
    • Initialize days to 0.
    • Use a do-while loop to:
      • Add dailySaving to totalSaved each day.
      • Increment days by 1.
      • Repeat the loop until totalSaved is greater than or equal to targetAmount.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 4. ChapterΒ 5
single

single

some-alt