write a program to check whether it is a Armstrong or not ?
Input : 153Output : Yes
153 is an Armstrong number.1*1*1 + 5*5*5 + 3*3*3 = 153
Discussion posts and replies are publicly visible
a!localVariables( local!n:tostring(ri!num), if(sum( power(a!forEach( items: enumerate(len(local!n))+1, expression: charat(ri!num,fv!item) ),3)) ==ri!num,"yes it is Armstrong number", "no it is not a Armstrong number"))
Did you try anything yourself? Where did you reach? And why don't you use the internet to get answers to such basic problems from sites like stackoverflow or geeksforgeeks?
a!localVariables( local!a: sum( power( tointeger(char(code(ri!num))), len(ri!num) ) ), if( local!a = ri!num, ri!num & " is an Armstrong Number", ri!num & " is not an Armstrong Number" ), )
Thank you Sir. Will take care of this from the next time.