a two digit number is 4 times the sum of its digits when 9 is added code example

Example 1: Given a long number, return all the possible sum of two digits of it. For example, 12345: all possible sum of two digits from that number are:

function digits(num){
  let numArray = num.toString().split('');
  let sumArray = [];
  
  for (let i = 0; i < numArray.length; i++) {
    for (let j = i+1; j < numArray.length; j++) {
      let sum;
      sum = Number(numArray[i]) + Number(numArray[j]);
      sumArray.push(sum);
    }
  } 
  return sumArray;  
}

Example 2: is a number equal to the sum of the digits of a number between two numbers

import math

def sumDigits(f,t,x):
    if f>t:
        if t>=10:
            r=math.floor(t/10)
            t=x-r
            t=t+r*10
            if(t<=f):
                print(t)
            else:
                return -1
        else:
            return -1    
    else:
        if f>=10:
            r=math.floor(f/10)
            f=x-r
            f=f+r*10
            if(f<=t):
                print(f)
            else:
                return -1
        else:
            return -1    
sumDigits(25,20,9)