Converting light years into astronomical units

Started by
4 comments, last by Raymond_Porter420 19 years ago
I'm terribly bad at math and I was wondering if anyone could help me with this conversion. How do I convert light years into astronomical units? I tried searching on Google numerous times but all I get is mc = square..etc... For reference: An astronomical unit is the average distance from the Earth to the Sun (about 150,000,000 km or 93,000,000 miles) and a light year is the distance light travels in a year (about 10 trillion kilometers or 6 trillion miles). (The nearest star after the Sun is about 4.2 light years away.) Use type double (as in Listing 2.4) and this conversion factor: 1 light year = 63240 astronomical units Thanks in advance!
-PixelOp
Advertisement
Maybe I'm mistaken....but if you know how many astronomical units are in a light year, what are you trying to convert? Oh yea and you should read the Forum FAQ
That looks suspiciously like a homework assignment.

This looks suspiciously like homework ("as in Listing 2.4")

But... The math is simple enough (practically 1st grade), but I'm not going to type out the source-code..

lenghtAU = lengthLY * 63240
According to www.onlineconversion.com...

1 light year = 63,197.7909299 astronomical units
since 1 light year = 63240 astronomical units

AU(LY) = LY * ( 1 ly / 63240 au )
LY(AU) = AU * ( 63240 au / 1 ly )

This topic is closed to new replies.

Advertisement