+ 1

Write a code which take input of number and give output a number whose digit is in reverse order but of only five from last.

If input number is less than five number then give '0' in output in place of that to complete 5 digit. For ex- If input is 12345 then output will be 54321. if input will be 1234567 then output will be 76543. If input will be 123 then output will be 32100.

31st Dec 2017, 11:45 AM
PRANAV VATSA
PRANAV VATSA - avatar
1 Odpowiedź
+ 7
Get input as string, reverse print it using a loop which only iterates 5 times. If string length is less than 5, print "0" in place of str[i]. Voila.
31st Dec 2017, 12:19 PM
Hatsy Rei
Hatsy Rei - avatar