Design and Develop a java program to find whether the given number is Armstrong or not.

Program Code:
import java.io.*;
public class Arm
{
public static void main(String args[])
{
int k=Integer.parseInt(as[0]);
int n=k,d=0,s=0;
while(n>0)
{
d=n%10;
s=s+(d*d*d);
n=n/10;
}
if(k==s)
System.out.println("Armstrong number”);
else
System.out.println("Armstrong number”);
}

Output
153
Armstrong number
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: