# Help me

#### Haziqrazale

The semester started on Monday of week 1; call that day number 1. On day 8, it was Monday of week 2 and on day 15, it was Monday of week 3.

Write a program which asks the user to enter the number of day and display the result.

a) what day of the week it is
b) what week number it is

Hint: The day of the week is related to the remainder when n−1 is divided by 7, while the week number is related to (n − 1)/7. Modify your program to give the week number and day of the week for any n. (For the day of the week print a number in the range 0-6, which decodes as Mon=0, Tue=1, Wed=2... Sun=6.)

#### John Joe

Hi, what have you tried so far?

#### Haziqrazale

Hi, what have you tried so far?

This is what i've tried so far. Can this be accomplished without an if-else statement? I just began learning c programming 2 weeks ago so this is quite challenging for me

The answer is in the hint.

Your input should only be one number, let's say "n = 27"

The lesson is intended to teach you two things: integer division and modulus

Take the input: n = 27

week: ( (n -1) / 7 ) + 1 = 4 (integer division) The +1 is because the weeks are numbered starting at 1 whereas the days are 0-6
day: ( n -1) % 7 = 5 (Saturday) modulus i.e. the remainder

Hope that helps.