Difference between a number and it's reverse

 Coding Problem Keys 

 Difference between a number and it's reverse 

 Problem Statement 

The number N is passed as input. The program must print the difference between the number N and it's reverse R.

 Boundary Condition(S) 

10 <= N <= 9999999

 Input Format 

The first line denotes the value of N.

 Output Format 

The first line contains the value of difference of N and R.

 Example Input/Output 1 

 Input 

42

 Output 

18

 Explanation 

The output is 42 - 24 = 18.

 Example Input/Output 2 

 Input 

555

 Output 

0

 Explanation 

The output is 555 - 555 = 0.

 Example Input/Output 3 

 Input 

125

 Output 

-396

 Explanation 

The output is 125 - 521 = -396.

 Note: Max Execution Time Limit: 5000 millisecs 

 Solution 

 Programming Language: Python 3 Language 

n=input().strip()
print(int(n)-int(n[::-1]))

# Published By PKJCODERS

 (Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.) 

Comments

Popular Posts

Unique Characters

Reverse Array

Largest Possible N - Divisible by 4

Vowels Count

Function samePositionBitCount - CTS Pattern

Snakes and Ladders