Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions algorithms/maths/is_armstrong.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
%% Armstrong no

function n= is_armstrong(num)
if(num<0)
n=0; %as negative no can't be armstrong
end
sum=0;
temp=num;
while(temp>0)
sum=sum*10 + rem(temp,10);
temp=fix(temp/10);
end
if(sum==num)
n=1; % the no is armstrong
else
n=0; % the no is not armstrong
end
end