Computer Science, asked by sagarjitparui0, 13 days ago

import java.util.Scanner;.
public class KboatPalindromeNumber
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in); System.out.println("Enter the number: ");
int num = in.nextInt();
int copyNum = num;
int revNum = 0;
while(copyNum != 0)
{
int digit = copyNum % 10;
copyNum /= 10;
revNum = revNum * 10 + digit;
}
if (revNum == num)
System.out.println("A Palindrome number");
else
System.out.println("not a Palindrome number");
}
}






can anyone tell what are the variable used in this program​

Answers

Answered by atrs7391
2

In your given program, the variables used are,

  • in - For the Scanner class to take inputs
  • num - To store the taken input
  • copyNum - To copy and store the value of variable num
  • revNum - To reverse the value of variable copyNum and then store and check with variable num that it is a Palindrome number or not.

Similar questions