Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: do-while Loop | Section
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C# Basics
Sectionย 1. Chapterย 41
single

single

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ย 1. Chapterย 41
single

single

Ask AI

expand

Ask AI

ChatGPT

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

some-alt