Computer Science, asked by harsha59461, 11 months ago

Write a program in Java to check whether a number is a Armstrong number or not Using scanner class & loop statement !!!

Answers

Answered by OfficialAditya
0

Answer:

import java.util.*;

public class Armstrong

{

public static void main ( String args )

{

Scanner sc=new Scanner (System.in);

int n,c=0,p=0,t=n;

while(n!=0)

{

c=n%10;

p=p+c*c;

n=n/10;

}

if(p==n)

System.out.println("Armstrong no.");

else

System.out.println("Not Armstrong no.");

Similar questions