To break loop in C#/CSharp, we make use of break statement. Following example demonstrates how you can break or exit for loop in C# when a certain condition is met. using System; namespace Hello_World { class Program { static void Main(string args) { for (int i = 0; i <= 100; i++) { Console.WriteLine(i); //Condition
Sample code is given below. Make sure MM is in capital letters. using System; namespace Hello_World { class Program { static void Main(string args) { DateTime today = DateTime.Now; string dt = today.ToString("dd/MM/yyyy"); Console.WriteLine(dt); } } } ;