+ 3
Can you help me to change it in java codeš
Sum reverse https://code.sololearn.com/cxAKCUs2pVq0/?ref=app
5 Answers
+ 3
Try wrapping your code in the Program class for it to run on Sololearn...
public class Program
{
public static void main(String[] args) {
}
}
+ 3
import java.util.Scanner;
public class Ecyojer {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int num1=sc.nextInt();
int num2=sc.nextInt();
int rnum1 = reverseNum(num1);
int rnum2 = reverseNum(num2);
int sum = rnum1+rnum2;
System.out.println(sum);
}
public static int reverseNum(int n)
{
int reverse = 0, rem;
while (n != 0)
{
rem = n % 10;
reverse = reverse * 10 + rem;
n /= 10;
}
return reverse;
}
}
+ 2
Paul K Sadler
The code needs to be changed syntax completely from C++ to JAVA
+ 2
Yes, that's correct. I was giving a starting point for the conversion. But, stopped short of doing it for her since the effort of doing it, is the best way to learn.