How to use step increment for loop in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i < 10; i += 2) {
                Console.WriteLine(i);
            }
        }
    }
}


/*
run:
   
1
3
5
7
9
 
*/

 



answered Aug 18, 2018 by avibootz

Related questions

1 answer 344 views
1 answer 312 views
1 answer 344 views
1 answer 278 views
278 views asked Aug 19, 2018 by avibootz
1 answer 319 views
2 answers 260 views
1 answer 386 views
386 views asked May 27, 2021 by avibootz
...