Business Studies, asked by pranalinikrad, 30 days ago

write a javascript program to accept a number form user and check whether it is armstrong number or not​

Answers

Answered by swapanojha1442
0

Answer:

import java.util.*;

public class Armstrong no.

{

public static void main(String args [])

{

Scanner.in= new Scanner (Sysrem.in);

int a,n,s=0

System.out.println(Enter a number);

n=in.nextInt();

do

{

a=n%10;

s=s+(a*a*a);

n=n/10;

}

while(a!=0);

if(n=s)

System.out.println(n+"is an Armstrong number");

else

System.out.println(n+"is not an Armstrong number");

}

}

Similar questions