Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

#Day82#100DaysChallenge- Matlab Loops| Armstrong Number in the given range

#Day82-Armstrong Number in the given range

Task:

Write a code to find prime number in given range
0 is an Armstrong number
1 is an Armstrong number
2 is an Armstrong number
3 is an Armstrong number
4 is an Armstrong number
5 is an Armstrong number
6 is an Armstrong number
7 is an Armstrong number
8 is an Armstrong number
9 is an Armstrong number

Note: This code can be done using the in-built command. But for the challenge, I am trying to avoid those.

Matlab code

function listofarmstrongnumber(l,u)

for i=l:1:u

    fprintf('%d is',i);

    armstrong_numberornot(i);

    fprintf('\n');

end

Sample Input and Output

8 is an armstrong number

9 is  an armstrong number

10 is Not an armstrong Number

11 is Not an armstrong Number

12 is Not an armstrong Number

13 is Not an armstrong Number

14 is Not an armstrong Number

15 is Not an armstrong Number


Click here for Video Description





Live Support: t.me/matlabirawen


 

 


No comments

Popular Posts

Followers