@LearningandTeachingCoding07
A number is called as Armstrong number if sum of cubes of digits of number is equal to the number itself.
For example 0, 1, 153, 370, 371 and 407 are the Armstrong numbers.
====== Logic behind the code===========
371 = 3*3*3 + 7*7*7 + 1*1*1
= 27 + 343 + 1
= 371
=========== Explanation of reverse program===============
step 1: Store input number in variable 'num' from user.
step 2: Value of variable 'num' would change in the while loop so we are storing it in another variable 'originalNum' to compare the results at the end of program.
step 3: We are adding cubes of every digit in variable 'r' and storing the sum in variable 'result'.
step 4: If 'result' of cubes of every digit is equal to number itself which is 'originalNum' then the number is Armstrong.
I hope guys you have understood it well.
#LearningandTeachingCoding
#CProgrammingTutorials
#CPrograms