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 234 views
1 answer 185 views
185 views asked Aug 19, 2018 by avibootz
1 answer 208 views
1 answer 179 views
1 answer 216 views
2 answers 147 views
1 answer 253 views
253 views asked May 27, 2021 by avibootz
...