Given current day as **day** of the week and an integer **K**, the task is to find the day of the week after K days.

**Examples:**

Input:day = “Monday”, K = 3

Output:Thursday

Input:day = “Tuesday”, K = 101

Output:Friday

**Approach:**

- Store all the days of the week (Mon to Sun) in a list.
- Find the
**index**of the**current day**from that list. - Print the value stored in

((K + index) % 7)th index

in the array.

Below code is the implementation of the above approach:

## Java

`import` `java.util.*; ` ` ` `public` `class` `GFG { ` ` ` ` ` `public` `static` `String dayFind( ` ` ` `String newDay, ` `int` `k) ` ` ` `{ ` ` ` ` ` `// Create an array with ` ` ` `// days of the week ` ` ` `List<String> days ` ` ` `= ` `new` `ArrayList<String>() {{ ` ` ` `add(` `"Monday"` `); ` ` ` `add(` `"Tuesday"` `); ` ` ` `add(` `"Wednesday"` `); ` ` ` `add(` `"Thursday"` `); ` ` ` `add(` `"Friday"` `); ` ` ` `add(` `"Saturday"` `); ` ` ` `add(` `"Sunday"` `); ` ` ` `} }; ` ` ` ` ` `// Find index of current ` ` ` `// day in days array ` ` ` `int` `index ` ` ` `= days.indexOf(newDay); ` ` ` ` ` `// return final day ` ` ` `return` `days ` ` ` `.get((index + k) % ` `7` `); ` ` ` `} ` ` ` ` ` `// Driver function ` ` ` `public` `static` `void` `main(String[] args) ` ` ` `{ ` ` ` ` ` `String str = ` `"Monday"` `; ` ` ` ` ` `System.out.println( ` ` ` `dayFind(str, ` `3` `)); ` ` ` `} ` `} ` |

*chevron_right*

*filter_none*

## Python3

`def` `dayFind(newDay, k): ` ` ` ` ` `# Create an array with ` ` ` `# days of the week ` ` ` `days ` `=` `[ ` `"Monday"` `, ` ` ` `"Tuesday"` `, ` ` ` `"Wednesday"` `, ` ` ` `"Thursday"` `, ` ` ` `"Friday"` `, ` ` ` `"Saturday"` `, ` ` ` `"Sunday"` `] ` ` ` ` ` `# Find index of current ` ` ` `# day in days array ` ` ` `index ` `=` `0` ` ` `for` `i ` `in` `range` `(` `len` `(days)): ` ` ` `if` `days[i] ` `=` `=` `newDay: ` ` ` `index ` `=` `i ` ` ` ` ` `# Return final day ` ` ` `return` `days[(index ` `+` `k) ` `%` `7` `] ` ` ` `# Driver code ` `if` `__name__ ` `=` `=` `'__main__'` `: ` ` ` ` ` `str` `=` `"Monday"` ` ` `print` `(dayFind(` `str` `, ` `3` `)) ` ` ` `# This code is contributed by mohit kumar 29` |

*chevron_right*

*filter_none*

## C#

`using` `System; ` `using` `System.Collections.Generic; ` `class` `GFG{ ` ` ` `public` `static` `String dayFind(String newDay, ` ` ` `int` `k) ` `{ ` ` ` ` ` `// Create an array with ` ` ` `// days of the week ` ` ` `List<String> days = ` `new` `List<String>(); ` ` ` ` ` `days.Add(` `"Monday"` `); ` ` ` `days.Add(` `"Tuesday"` `); ` ` ` `days.Add(` `"Wednesday"` `); ` ` ` `days.Add(` `"Thursday"` `); ` ` ` `days.Add(` `"Friday"` `); ` ` ` `days.Add(` `"Saturday"` `); ` ` ` `days.Add(` `"Sunday"` `); ` ` ` ` ` `// Find index of current ` ` ` `// day in days array ` ` ` `int` `index = days.IndexOf(newDay); ` ` ` ` ` `// return readonly day ` ` ` `return` `days[(index + k) % 7]; ` `} ` ` ` `// Driver Code ` `public` `static` `void` `Main(String[] args) ` `{ ` ` ` `String str = ` `"Monday"` `; ` ` ` ` ` `Console.WriteLine(dayFind(str, 3)); ` `} ` `} ` ` ` `// This code is contributed by Rajput-Ji ` |

*chevron_right*

*filter_none*

**Output:**

Thursday

**Time Complexity: ** O(1)

**Space Complexity: **O(1)

## Recommended Posts:

- Total number of days taken to complete the task if after certain days one person leaves
- Program to convert given number of days in terms of Years, Weeks and Days
- Find day of the week for a given date
- Tomohiko Sakamoto's Algorithm- Finding the day of the week
- Count of days remaining for the next day with higher temperature
- Date after adding given number of days to the given date
- Find number of days between two given dates
- Find temperature of missing days using given sum and average
- Program to calculate the number of odd days in given number of years
- Find array sum using Bitwise OR after splitting given array in two halves after K circular shifts
- Finding number of days between two dates using StringStream
- Number of days until all chocolates become unhealthy
- Converting seconds into days, hours, minutes and seconds
- C program to print number of days in a month
- Maximize number of days for which P chocolates can be distributed consecutively to N people
- Find the day number in the current year for the given date
- Zeller's Congruence | Find the Day for a Date
- Program to find the time remaining for the day to complete
- Maximize Profit by trading stocks based on given rate per day
- Program to wish Women's Day

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.