How to count backwards (Print the numbers N, N - 1, ..., 0 (included)) in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main()
    {
        int n = 5;
        
        for (int i = n; i >= 0; i--) {
            Console.Write(i + " ");
        }
    }
}



/*
run:

5 4 3 2 1 0 

*/

 



answered Jul 20, 2025 by avibootz
...