Good morning.
Today I just tell you how to create Armstrong number or how to check a given number is Armstrong number
or not.
In view.
So as you see over here, I just select a example.
153 is in Armstrong number or not.
So the basic logic behind the Armstrong number is that if you just separate all the digits at different
places and you just cube it individually, and the sum of all these digits with cube is equal to the
equivalent given number when the sum of the cube of the individual digits of a number is equal to the
number, the number is called Armstrong number.
Okay.
So let's how to do it in LabVIEW.
Let's check.
So just go to my block diagram window over here.
I just first insert a number and the number is my integer number, so I just make it side by side.
So over here, this is my input number.
This is my input number after this because this is my floating number.
I just need to convert it to
integer.
So right now I just use it I32.
So this is my input number.
Just put 153 inside it.
After this I need to convert these integer into separate numbers for that purpose.
I just first convert it into string number to decimal string.
Then over here I just create an indicator.
So over here I got the decimal equivalent string of this given number.
As you see over here.
Now, I need to separate all these digits.
153.
Okay, so for that purpose, I just go to string string subset.
Connect this one.
You need to set the offset.
You need to set the length.
And over here I got the sub string create indicator.
So this is the sub string first.
Let's run it.
One is separated from the given string like this.
I just copy over here.
This is my second.
Just make input.
String offset is my one.
Now length is the same.
Let's check again.
Run it.
As you see, five is separated from the given string like this.
We just separate the third digit.
Connect it over here.
Offset is two.
You can name it.
Also this is the string
equivalent
over here.
First digit, second digit, and this is my third digit.
This program is for only three digits.
Okay.
So now I got all the three digits as you see.
Now I just need to cube off, get the cube of all these numbers.
So before this, I just need to convert this string into number again.
I just go to conversion decimal string to number conversion.
I just need just connect over here and over here.
I got the number.
Let's check.
As you see, this is the number.
I just delete this number indicator from here because I need to cube root.
I get the cube root of all these.
So you need to connect over here.
This one Now for the cube root.
I just go to the compound function over here.
Just change the mode to the multiply.
Connect this to number.
Now I got the cube root.
You can check also create indicator over here.
One cube root is equivalent to one.
As you see, this is the result.
Same way I just connect all the three digits remaining.
Two digits
indicator over here again.
Indicator three is there.
Just need to connect over here.
Now let's run it.
This is my two.
This is my three indicator.
Run it.
As you see, one cube root is one five cube root is 125 three cube root is not cube root cube three
cube is 27.
Okay.
So now I just need to add all these numbers,
all these given numbers.
And over here, I got the result.
Let's check what happened inside this planet.
I got 153, as you see.
And I just put an indicator also, which will display the given number is Armstrong number or not.
So if it is true, it is my Armstrong number.
Otherwise it is not.
Name it Armstrong number.
So for that purpose, I just put a logic.
When the input number is equivalent to the given number.
In that case, it is a Armstrong number, let's say.
As you see, the given number is Armstrong number.
So this is the code right now.
The these indicators are not required.
You just delete also all these indicators in between.
Let's delete these indicators.
Delete this one indicator also.
So I need this one, the input number and the result and the output.
If both are same, the given number is my Armstrong number.
So this is how you can go with or how to check the given number is Armstrong number or not.
Let's do it for another number.
Right now.
I just put 144
before this.
I need to clear all the broken wires as you see over here, Ctrl B, so run it.
So given number is not Armstrong number, let's check for another one.
135 Again, the given number is not Armstrong number,
so I just go with 153 Let's so given number is Armstrong number, let's check for 111.
Again, it is not a Armstrong number.
So this is how you can check the given number is Armstrong number or not in LabVIEW.
So this is all about today's lecture.
Thank you.
Over here.
This is the code you can try on your own.
I just make the labels visible.
Visible item label control you to minimize the structure.
Okay, so this is the code.
Thank you.