Results 1 to 2 of 2

Thread: equation help...

  1. #1
    Apr 2008

    equation help...

    not sure if this is the right place.

    ok I am trying to figure out this equation inside a computer program.

    486 = (x -1) * 40 + y

    given 0 < x <= 12 and y < 0 <= 31.

    there is only 1 answer for both variables.

    so a user inputs the '486' or whatever they put in and this formula is supposed to figure out the birth month and birth day by reversing that formula.

    not sure if that makes sense.

    but for those familiar with programming I dont want to write a list of if statements, rather do it all with math.

    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member angel.white's Avatar
    Oct 2007
    Well, just as it is, Id say do something like this:

    In C:
    int main()
        int BirthNumber, Month, Day;
        printf( "Enter your birth number: ");
        scanf ( "%d", &BirthNumber);
        Month = BirthNumber/40 + 1;  
        Day   = BirthNumber - 40*(Month - 1);
        printf( "\nYou were born on %d/%d.\n\n", Day, Month);
    return 0;
    Note to OP: I haven't had a chance to test this, It may have errors.

    Note for people who don't program: The datatype "int" stands for "integer" this means it will (or should, as I said, I haven't tested it) truncate the remainder, so for example, my BirthNumber would be 94, then 94/40 will return 2 (not 2.35), because BirthNumber is an integer. An important distinction, or Day would always be set equal to zero.

    Though I don't know how useful it is, the definition of BirthNumber seems somewhat obscure.

    Edit: Okay, I tested it and it works. It displays 14/3 for me, which is correct.
    Last edited by angel.white; Apr 3rd 2008 at 06:05 PM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 1
    Last Post: Apr 11th 2011, 01:17 AM
  2. Partial differential equation-wave equation - dimensional analysis
    Posted in the Differential Equations Forum
    Replies: 3
    Last Post: Aug 28th 2009, 11:39 AM
  3. Replies: 2
    Last Post: May 18th 2009, 12:51 PM
  4. Replies: 2
    Last Post: Apr 28th 2009, 06:42 AM
  5. Replies: 1
    Last Post: Oct 23rd 2008, 03:39 AM

Search Tags

/mathhelpforum @mathhelpforum