Computer Science, asked by JanmejoyPradhan, 11 months ago

WAP to take a three digit no as input then get
its mirror image. Then find out the absolute
difference between the no. and the mirror image​

Answers

Answered by Anonymous
1

Explanation:

import java.util.*;

class Mirror_image

{

{

public static void main ( String args [ ])

{

Scanner sc = new Scanner (System.in);

int num1,num2,i,r,sum=0,diff=0,a;

System.out.println("Enter a three digit number");

num1=sc.nextInt();

for ( i=1, i<=num1 ; i++ )

{

r=num1 %10;

sum=sum*10+r;

num1=num1/10;

}

diff= num1-sum ;

a=Math.abs(diff);

System.out.println("mirror image of " + num1 + " is " + sum);

("The difference between these two numbers is " + a)}

}

}

Similar questions