Use double value to control for loop - CSharp Language Basics

CSharp examples for Language Basics:for

Description

Use double value to control for loop

Demo Code

using System;/* w w w  . jav  a  2 s  .c o  m*/
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
   static void Main(string[] args)
   {
      // Output
      for (double number = 9; number >= 0; number -= 0.9)
      {
         Console.WriteLine(number.ToString("N1"));
      }
   }
}

Result


Related Tutorials