Simple for loop in C#
- Admin
- Jun 24, 2024
- 1 min read
To write all the number from 0 to 10
for (int i = 1; i <= 10; i++){ Console.Write($"{i} ");}output:1 2 3 4 5 6 7 8 9 10 To write all the letter of a text
Console.WriteLine("input a text :");string text = Console.ReadLine();for (int i = 0; i < text.Length; i++){ Console.Write($"{text[i]} ");}
Comments