## Kotlin Program:

- To check number is Armstrong or not

#### Example:

User Input:1

Output: Armstrong Number

``````import java.util.Scanner
fun main(args: Array<String>) {

val userInput = Scanner(System.`in`)
var num:Int = userInput.nextInt()
var digit:Int
var sum:Int = 0
var num2:Int = num
while(num!=0) {
digit=num%10
sum= sum + digit*digit*digit
num/=10
}

if(num2==sum)println("Armstrong Number")
else println("Not a Armstrong Number")

}``````

### Output:

```  Enter Your number : 407
Armstrong Number
```
Program
number

You must know first,

Armstrong Number : if a number & cube of every single digit of the number are equal than the number is an Armstrong number

Example :

```Number: 407 & cube of every single digit = 407. so it's an Armstrong Number
(4*4*4)+(0*0*0)+(7*7*7) = 64+0+343 = 407```

``````//Save the original number
num2=num

//find every single digit & add the cube of it
while(num!=0) {
digit=num%10
sum=sum + digit*digit*digit
num/=10
}

//check for the Armstrong
if(num2==sum)
``````
Concept

Coming Soon !

Quick
Tutorial

# Quote

Make bold choices and make mistakes. It’s all those things that add up to the person you become.