write a java program
accept a 2 digit number and print its reverse value
Answers
Answered by
1
Answer:
import java.util.*;
public class SumOfTwoDigit
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter two digit number=");
int a=sc.nextInt( );
int b=a%10;
int c=a/10;
int d=a%10;
System.out.println("reverse value was="+d+c);
}
}
Explanation:
Answered by
1
Answer:
import java . util . *
Class Reverse;
Public static void main (String args[])
int n,s,p,rev=0;
Scanner sc = new Scanner (System . in);
System. out . print ln ("Enter a Number");
int n = sc.next Int();
s = n;
while(s > 0)
{ p = s % 10 ;
rev = ( rev * 10 );
s = s/10;
}
System.out.println("Reverse of the given number is +" rev); }
}
Hope this will help you
Similar questions