Computer Science, asked by shuklaharsh933, 7 months ago

write a program to input a array of 20 integers and check that element is armstrong element or not​

Answers

Answered by ashokkumar5337x
0

Answer:

Here we will write a java program that checks whether the given number is Armstrong number or not. We will see the two variation of the same program. In the first program we will assign the number in the program itself and in second program user would input the number and the program will check whether the input number is Armstrong or not.

Before we go through the program, lets see what is an Armstrong number. A number is called Armstrong number if the following equation holds true for that number:

xy..z = xn + yn+.....+ zn

where n denotes the number of digits in the number

For example this is a 3 digit Armstrong number

370 = 33 + 73 + o3

= 27 + 343 + 0

= 370

Let’s write this in a program:

To understand this Program you should have the knowledge of following Java Programming topics:

Java while loop

Java if..else-if

Similar questions