.net19. Give the syntax of using the for loop in C# code?
The syntax of using the for loop in C# code is given as follows:
for(initializer; condition; loop expression)

In the preceding syntax, initializer is the initial value of the variable, condition is the expression that is checked before the execution of the for loop, and loop expression either increments or decrements the loop counter.
The example of using the for loop in C# is shown in the following code snippet:
for(int i = 0; i < 5; i++)
In the preceding code snippet, the word Hello will be displayed for five times in the output window.

Written by 

Leave a Reply

Your email address will not be published. Required fields are marked *