Computer Science, asked by shantannu202003, 1 year ago

wap to input a number check whether it is armstrong number or not
ex-153
1^3=1
5^3=125
3^3=27
1+125+27=153
A number whose sum of cubes of digits is equal to that number

Answers

Answered by straightvision89
1

Answer:

A positive integer is called an Armstrong number of order n if abcd. ... 153 = 1*1*1 + 5* 5*5 + 3*3*3 // 153 is an Armstrong number. Example #1: Check Armstrong Number of three digits.

Answered by amannishad0512p5zxh6
8

import java.util.*;

class Armstrong

{

public static void main( )

{

Scanner sc =new Scanner(System.in);

int t=0,a,n;

System.out.println("Enter the number");

n=sc.nextInt( );

h=n;

while(n!=0)

{

a=h%10;

t+=(int)Math.pow(a,3);

h/=10;

}

if(t==n)

System.out.println("Armstrong");

else

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

}

}

Pls compile and run your code,pls subscribe to my YouTube channel ,see mine brainly profile.

Similar questions