A 5-digit positive integer is entered through the keyboard, write a recursive and a non-recursive function to calculate sum of…