Q:

Write a program in C# Sharp to print the name of month in full starting from current date

0

Write a program in C# Sharp to print the name of month in full starting from current date.

Expected Output :

 Display the name of the months of a year :                            
-----------------------------------------------                        
 The date of Today : 13/06/2017                                        
 The twelve months are :                                               
 June                                                                  
 July                                                                  
 August                                                                
 September                                                             
 October                                                               
 November                                                              
 December                                                              
 January                                                               
 February                                                              
 March                                                                 
 April                                                                 
 May

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;

class dttimeex51
{
    static void Main()
    {
    Console.Write("\n\n Display the name of the months of a year :\n");
	Console.Write("-----------------------------------------------\n");
	DateTime now = DateTime.Now;
	Console.WriteLine(" The date of Today : {0}",now.ToString("dd/MM/yyyy"));
	Console.WriteLine(" The twelve months are :");
	for (int i = 0; i < 12; i++)
	{
	    Console.WriteLine(" {0}",now.ToString("MMMM"));
	    now = now.AddMonths(1);
	}
	Console.WriteLine();
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now