write a program in java to accept a number and display sum of its original number and reverse it.
reply fast
Answers
Answer:
import java.util.Scanner;
public class KboatDigitReverse
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter Number: ");
int orgNum = in.nextInt();
int copyNum = orgNum;
int revNum = 0;
while(copyNum != 0) {
int digit = copyNum % 10;
copyNum /= 10;
revNum = revNum * 10 + digit;
}
int diff = revNum - orgNum;
System.out.println("Reversed Number = " + revNum);
System.out.println("Absolute Difference = " + Math.abs(diff));
}
}
Explanation:
Yeah gave yours and try to brainliest answer please
Explanation:
import java.util.Scanner; public class KboatGCD { public static void main(String args[]) { Scanner in = new Scanner(System.in); System.out.print("Enter first number: "); int a = in.nextInt(); System.out.print("Enter second number: "); int b = in.nextInt(); while (b != 0) { int t = b; b = a % b; a = t; } System.out.println("GCD=" + a); } }