Demonstrating a do loop in C#
###### Posted by Gizmosis350k
Last Updated: April 03, 2012
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ch04Ex04
{
class Program
{
static void Main(string[] args)
{
double balance, interestRate, targetBalance;
Console.WriteLine("What is your current balance?");
Console.WriteLine("What is your current interest rate (in %)?");
Console.WriteLine("What balance would you like to have?");
int totalYears = 0;
do
{
balance *= interestRate;
++totalYears;
}
while (balance < targetBalance);
Console.WriteLine("In {0} year{1} you'll have a balance of {2}.",
totalYears, totalYears == 1 ? " " : "s", balance);
}
}
}

From what i understand this statement has the program repeat execution of a calculation until a goal is reached (i.e. a boolean value is proved false after being true for x number of calculations)
This is very useful for a variety of calculations, and has endless practical and semi-practical applications.
To be honest, i deven know if imma be using this in my program, but i sense the need to declare around 400 variables.
(big man ting)

###### Find factorial using loop in C++
Samath | Nov 02, 2014
###### C Program that Print First 10 Natural Numbers using For, While and Do-While Loop
Samath | Jan 02, 2017
###### Java program that uses a loop to compute the sum of all even numbers between 2 and 100 (inclusive)
Samath | Apr 03, 2022
###### Javascript program that check if a word is palindrome using one for loop
SceDev | Feb 17, 2024
###### Java program that uses a loop to compute the sum of all squares between 1 and 100 (inclusive)
Samath | Apr 03, 2022
###### Java program that uses a loop to compute the sum of all even numbers between a and b (inclusive), where a and b are inputs
Samath | Apr 03, 2022
###### Java program that uses a loop to compute the sum of all odd digits of an input. (For example, if the input is 32677, the sum would be 3 + 7 + 7 = 17.)
Samath | Apr 03, 2022