Iteration Statement with Do Loop in C#

Now we are going to learn about iteration statement in C#.
  • 7582

Introduction

The iterations in c# work as like the expression in programming language. The Do statement executes or a block of statements enclosed in { } Opening and closing braces it's statement repeat until specific expression is not complete.   

Example

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
   public
class ABC
  
{
        public
static void Main()
        {
        int
x = 0;
         
do
          
 {
           Console.WriteLine(x);
             x++;
            } while (x < 9);
             Console.ReadLine();             
         }
     }
  }

Output

itration.jpg

© 2020 DotNetHeaven. All rights reserved.