w3resource logo


C# Sharp Programming Exercises

C# Sharp Exercises: Compute what day will be tomorrow

Secondary Nav

C# Sharp DateTime : Exercise-45 with Solution

Write a program in C# Sharp to compute what day will be tomorrow.

Expected Output :

Today is : 17/09/2016
 The Tomorrow will be : 18/09/2016 

C# Sharp Code:

using System;

class dttimeex45
{
    static void Main()
    {
	Console.Write("\n\n Compute what day will be Tomorrow :\n");
	Console.Write("----------------------------------------\n");
	Console.WriteLine(" Today is : {0}", DateTime.Today.ToString("dd/MM/yyyy"));
	DateTime dt = GetTomorrow();
	Console.WriteLine(" The Tomorrow will be : {0} \n", dt.ToString("dd/MM/yyyy"));
    }
    static DateTime GetTomorrow()
    {
	return DateTime.Today.AddDays(1);
    }
}

C# Sharp Practice online:

using System;

class dttimeex45
{
    static void Main()
    {
	Console.Write("\n\n Compute what day will be Tomorrow :\n");
	Console.Write("----------------------------------------\n");
	Console.WriteLine(" Today is : {0}", DateTime.Today.ToString("dd/MM/yyyy"));
	DateTime dt = GetTomorrow();
	Console.WriteLine(" The Tomorrow will be : {0} \n", dt.ToString("dd/MM/yyyy"));
    }
    static DateTime GetTomorrow()
    {
	return DateTime.Today.AddDays(1);
    }
}

Improve this sample solution and post your code through Disqus.



Join our Question Answer community to learn and share your programming knowledge.

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program