You asked:

how long does it take the mars to orbit the sun

Mars
Mars
the Sun
the Sun

The length of the orbit of Mars around the Sun is 686.97 days and 1.88 years.