Here's a Java version:
public class age{
public int sumDigits(int x)
{
String s = String.valueOf(x);
int sum = 0;
for(int i = 0; i1925; i--)
{
int age = 2025 - i;
int tot = sumDigits(i);
if(age == tot) System.out.println(String.valueOf(i)+" "+String.valueOf(age));
}
}
public static void main(String[] args){
new age();
}
}
If AB doesn't mess it up, it can be run here:
https://www.programiz.com/java-programming/online-compiler/