A theoretical study of stability, electronic, and optical properties of GeC and SnC