Write a program in Java to check whether a number is a Armstrong number or not Using scanner class & loop statement !!!
Answers
Answered by
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
English,
5 months ago
Math,
5 months ago
Math,
5 months ago
Social Sciences,
11 months ago
Computer Science,
11 months ago