Have you tried exhaustive search ? ie go thru all x,y,z from 0 to 255 and see if you find a match. If you could take that it's slow this = should work! Note though it's slow (worst case several seconds) and it's a pretty "stupid" algorithm. Maybe it's possible to apply some shortcuts in it that will improve performance! /niklo -----Ursprungligt meddelande----- Fr=E5n: Thomas N [mailto:thomasn101@HOTMAIL.COM] Skickat: den 8 juli 2002 09:13 Till: PICLIST@MITVMA.MIT.EDU =C4mne: Fw: C Question. Please help! One more thing: The maximum values for variable x, y, and z is 256 Thanks! Thomas ----- Original Message ----- From: "Thomas N" To: "pic microcontroller discussion list" Sent: Monday, July 08, 2002 12:10 AM Subject: [OT]: C Question. Please help! > Hello everyone, > > How to I search for x, y, and z variables in the equation below to = get the > answer that's closest to Num variable using C language? > > Num =3D x * ( y * (3*z + 4) + 4) + 18 > > For example, if num =3D 122. The answer for x is 2, y is 3, z is 4. > > Best regards, > Thomas > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.