For an integer X, define the operation rev(X) to digit-reverse X and remove leading zeros. For example:
if X = 123, then rev(X) = 321;
if X = 100, then rev(X) = 1.
Now given integers x and y, rev(rev(x) + rev(y)) is required to be How many?
Input example 1:
123 100
Output example 1:
223
import java.util.Scanner; public class M4 { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int m=sc.nextInt(); int n=sc.nextInt(); String m1=String.valueOf(m); String n1=String.valueOf(n); String m2=new StringBuffer(m1).reverse().toString(); String n2=new StringBuffer(n1).reverse().toString(); int m3=Integer.parseInt(m2); int n3=Integer.parseInt(n2); int f=m3+n3; String f1=String.valueOf(f); String f2=new StringBuffer(f1).reverse().toString(); int o=Integer.parseInt(f2); System.out.println(o); } }