C# Sharp Exercises: Calculate the specified day of the week
C# Sharp DateTime: Exercise-9 with Solution
Write a C# Sharp program to calculate what day of the week is 40 days from this moment.
Sample Solution:-
C# Sharp Code:
using System;
public class Example9
{
public static void Main()
{
System.DateTime today = System.DateTime.Now;
System.Console.WriteLine("Today = "+System.DateTime.Now);
System.TimeSpan duration = new System.TimeSpan(40, 0, 0, 0);
System.DateTime answer = today.Add(duration);
System.Console.WriteLine("{0:dddd}", answer);
}
}
Sample Output:
Today = 6/10/2017 11:57:49 AM Thursday
Flowchart :

C# Sharp Code Editor:
Improve this sample solution and post your code through Disqus
Previous: Write a C# Sharp program to retrieve the current date.
Next: Write C# Sharp program to determine the day of the week 40 days after the current date.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Exercises: Weekly Top 12 Most Popular Topics
- Pandas DataFrame: Exercises, Practice, Solution
- Conversion Tools
- JavaScript: HTML Form Validation
- SQL Exercises, Practice, Solution - SUBQUERIES
- C Programming Exercises, Practice, Solution : For Loop
- Python Exercises, Practice, Solution
- Python Data Type: List - Exercises, Practice, Solution
- C++ Basic: Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - exercises on Employee Database
- SQL Exercises, Practice, Solution - exercises on Movie Database
- SQL Exercises, Practice, Solution - exercises on Soccer Database
- C Programming Exercises, Practice, Solution : Recursion