Problem Write a program in matlab to check whether the given number is Amstrong or not. Solution An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number since 3**3 + 7**3 + 1**3 = 371. To know more about Amstrong number visit the references below. To understand this program you need to know the following: Function definition in Matlab For loop in matlab num2str function in matlab length function in matlab str2num function in matlab logical function in matlab Find the explanation of the program below the program section Program function answer = isamstrong(n) %this function will give the result if the number is amstrong or not. %First convert the number to a string to split and check for the condition. n = num2str(n); %Create a sum variable to find the sum of the cubes of each digit in the %number and see if the number is equal to the given number or n
With Radius of Circle, people can learn to program and have hands-on tutorials with python and Matlab. ProjectEuler problems solutions are also available to have a better solution and improve the knowledge of people. A lot of algorithms which form the basic programming are also available. I hope the internet community will make use of this blog.