Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Problem of the day

You are given an integer ‘NUM’ . Your task is to find out whether this number is an Armstrong number or not.

A k-digit number ‘NUM’ is an Armstrong number if and only if the k-th power of each digit sums to ‘NUM’.

```
153 = 1^3 + 5^3 + 3^3.
Therefore 153 is an Armstrong number.
```

Detailed explanation

```
1 <= ‘T’ <= 100
1 <= ‘N’ <= 10^9
Time Limit: 1 sec
```

```
1
13
```

```
NO
```

```
As 1^2 + 3^2 = 10 which is not equal to 13.So we can say it is not an Armstrong number.
```

```
1
371
```

```
YES
```