how are we suppose to raise the power of the number depending upon the number of digits
Is asmstrong number
hello utkarsh,
let say abc is any number. where a ,b ,c are the digits of the number .
so
in order to check whether it is armstrong or not.
we need to calculate summation -> a^3 + b^3+c^3 (3 is the number of digits in a given number)
if that summation comes out to be equal to abc then it is armstrong otherwise not.
to calculate a^3 u can use pow function.
pow(a,3) will give u a^3 .
in general to calculate a^n - > pow(a,n)
do we need any other header file for this?
yeah
include cmath library
after ur first while loop value of n will become zero and then second while loop will never execute .
so store n in some temporary variable and modify that temporary variable only .
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
