using sprintf istead of itoa