Thread: help with a loop

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    That's a good start. You still have to figure out how you would do it on paper and turn that into an algorithm.

    Because you've gotten a good start I'll give you a hint. I would add up the number of days in the months before the selected month. For example, if they choose January, there are 0 days before January. If they choose February, there are 31 days before February. I would then divide that number by 7 and look at the remainder. For example, 31/7 = 4 remainder 3. So that means that February starts on the day of the week that is three days after the day that January starts on.

  2. #2
    Registered User
    Join Date
    Oct 2007
    Posts
    37
    so

    Jan 2000
    1 2 3 4 5 6 7 (start day)
    S M T W T F S (days in a week)
    x x x x x x x 1


    x 31

    here is what i got

    from Jan
    31%7 = 3
    3 is the start day for Feb 2000. which is Tuesday and i check the calender and it is correct.
    for March 2000.
    31+29+31 =91%7 =0 now what do i do.

    from calender March 2000 started on Wednesday.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. nested loop, simple but i'm missing it
    By big_brother in forum C Programming
    Replies: 19
    Last Post: 10-23-2006, 10:21 PM
  2. While loop misbehaving (or misunderstanding)
    By mattAU in forum C Programming
    Replies: 2
    Last Post: 08-28-2006, 02:14 AM
  3. loop in a linked linked lists
    By kris.c in forum C Programming
    Replies: 6
    Last Post: 08-26-2006, 12:38 PM
  4. while loop help
    By bliznags in forum C Programming
    Replies: 5
    Last Post: 03-20-2005, 12:30 AM
  5. loop issues
    By kristy in forum C Programming
    Replies: 3
    Last Post: 03-05-2005, 09:14 AM