Kaprekar Number



Problem to find the Kaprekar Number or not. Kaprekar Number is a given number is equal to the sum of the equal splited value of squared number.



 if n = 45

        Square the number     : 45*45 = 2025
        Split Equally         : 20 and 25
        sum of the split value: 20+25 = n.So It's Kaprekar Number.


 if n = 297

        Square the number     : 297*297 = 88209
        Split Equally         : 88 and 209
        sum of the split value: 88+209 = n.So It's Kaprekar Number.



Example-1:


Input    : n = 45
Output   : Kaprekar Number   


Example-2:


Input    : n = 297
Output   : Kaprekar Number   


Example-3:


Input    : n = 32
Output   : Not a Kaprekar Number   







Solution





n = 45

m = n*n

m = str(m)

a = len(m)//2

b = m[:a]

c = m[a:]

d = int(b) + int(c)

if(d==n):

    print("Kaprekar Number")

else:

    print("Not a Kaprekar Number")



Output



Kaprekar Number