Spoj LASTDIG2

**Spoj The Last Digit Re-Visited
Problem LASTDIG2 **
LASTDIG2 SPOJ
Here’s my code : http://ideone.com/kbCysL
Anyone Please Look into the code. Where i have gone wrong? Spoj showing WA :confused: ? ?

you are missing newline character ‘\n’ after every output . (there may be other mistakes i havenot seen the code properly )