1. ## 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.

thanks
mark

2. Well, just as it is, Id say do something like this:

In C:
Code:
#include<stdio.h>

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.