w3resource

C#: Compute what day will be tomorrow


Write a program in C# Sharp to compute tomorrow's day.

Sample Solution:-

C# Sharp Code:

using System;

class dttimeex45
{
    static void Main()
    {
        // Displaying the purpose of the program to the user.
        Console.Write("\n\n Compute what day will be Tomorrow :\n");
        Console.Write("----------------------------------------\n");

        // Display today's date to the user.
        Console.WriteLine(" Today is : {0}", DateTime.Today.ToString("dd/MM/yyyy"));

        // Calling the GetTomorrow method to retrieve tomorrow's date.
        DateTime dt = GetTomorrow();

        // Display tomorrow's date to the user.
        Console.WriteLine(" The Tomorrow will be : {0} \n", dt.ToString("dd/MM/yyyy"));
    }

    // Method to get tomorrow's date by adding 1 day to today's date.
    static DateTime GetTomorrow()
    {
        return DateTime.Today.AddDays(1);
    }
}

Sample Output:

 Compute what day will be Tomorrow :                                                                          
----------------------------------------                                                                      
 Today is : 12/06/2017                                                                                        
 The Tomorrow will be : 13/06/2017  

Flowchart:

Flowchart: C# Sharp Exercises - Compute what day will be tomorrow

Go to:


PREV :Write a program in C# Sharp to compute what day was yesterday.
NEXT : Write a program in C# Sharp to get the first day of the current year and first of a year against a given date.

C# Sharp Code Editor:



Improve this sample solution and post your code through Disqus

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.