1- //auto-generated code start
1+ //auto-generated code start
22using System ;
33using System . Collections . Generic ;
44using System . Linq ;
@@ -49,16 +49,22 @@ static void Main(string[] args)
4949 Console . ReadKey ( ) ; //waits for user key (enter, space...)
5050 return ; //it stops the program process
5151 }
52- Console . BackgroundColor = ConsoleColor . DarkCyan ; //changes font color
53- Console . WriteLine ( a ) ; //writes the number you typed
54- Console . BackgroundColor = ConsoleColor . Black ; //resets font color
52+
5553 // - THE MOST IMPORTANT PART IN THE CODE -
5654 // --------------------------------------------------
5755 //for cycle which prints the number backwards until 0:
58- // 1) We declare the long b which is a - 1 , suppose we typed the number 10, b will be 10 - 1
56+ // 1) We declare the long b which is equal to a , suppose we typed the number 10, long b will be 10
5957 // 2) We declare when the program stops, in this case it will stop when b will be minor or equal to a (never), so we created an infinite loop
6058 // 3) We declare what the program must do when it's in the cycle, in this case every time the cycle restarts it will subtract 1 to long b
61- for ( long b = a - 1 ; b <= a ; b -- )
59+ // PS: We can also use:
60+ // while (true) {
61+ //
62+ // if (b == 0) {
63+ // ...
64+ // replace return; with break;
65+ // }
66+ // }
67+ for ( long b = a ; b <= a ; b -- )
6268 {
6369
6470 if ( b == 0 )
@@ -87,4 +93,4 @@ static void Main(string[] args)
8793//▒█▄▄█ ▒█▒█▒█ ▒█░ ░▒█░░ ▒█▄▄█ ▒█░░░ ▒█░ ▒█▄▄█ ▒█▒█▒█ ▒█▄▄█ ▒█▄▄▀ ▒█░░▒█ ▒█░▄▄ ▒█▄▄▀ ▒█▄▄█ ▒█▒█▒█
8894//▒█░▒█ ▒█░░▀█ ▄█▄ ░▒█░░ ▒█░▒█ ▒█▄▄█ ▄█▄ ▒█░▒█ ▒█░░▀█ ▒█░░░ ▒█░▒█ ▒█▄▄▄█ ▒█▄▄█ ▒█░▒█ ▒█░▒█ ▒█░░▒█
8995
90- //-----------------------------------------------------------------------------------------------------//
96+ //-----------------------------------------------------------------------------------------------------//
0 commit comments