import java.util.*;
import java.lang.*;
import java.io.*;
// The main method must be in a class named "Main".
class Main {
public static void main(String[] args) {
// System.out.println("Hello world!");
int [] d1 = {7,8};
int [] d2 = {8,9};
int sum=0;
int carry =0;
int maxlen = Math.max(d1.length, d2.length);
int[] result = new int [maxlen+1 ];
for (int i =maxlen-1 ;i >=0 ; i--){
int n1= (i<d1.length) ? d1[i]:0;
int n2= (i<d2.length) ? d2[i]:0;
sum = n1+n2+carry;
result[i+1]= sum%10;
carry = sum / 10;
}
result[0] = carry;
for (int digi : result){
System.out.print(digi);
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: