Skip to content

Commit

Permalink
Create CheckDisariumNum.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DAKSH-tech authored Oct 2, 2020
1 parent bd682f0 commit 5a2c0a9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CheckDisariumNum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
def Length(n):
length = 0;
while(n != 0):
length = length + 1;
n = n//10;
return length;
num = int(input("Enter the number to check: "));
rem = sum = 0;
len = Length(num);
n = num;
while(num > 0):
rem = num%10;
sum = sum + int(rem**len);
num = num//10;
len = len - 1;
if(sum == n):
print(str(n) + " is a disarium number");
else:
print(str(n) + " is not a disarium number");

0 comments on commit 5a2c0a9

Please sign in to comment.