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 253 views
1 answer 201 views
201 views asked Aug 19, 2018 by avibootz
1 answer 228 views
1 answer 192 views
1 answer 233 views
2 answers 165 views
1 answer 274 views
274 views asked May 27, 2021 by avibootz
...