NUMFACT wa

my approach is similar to editorial.But it shows WA in several cases.Whats wrong with my approach?>

https://ideone.com/64Tmmy