Write a program in java to convert an Number to an Armstrong number.
Answers
Answered by
1
Explanation:
public static void main(String[] arg) { int i=100,arm; System. out. println("Armstrong numbers between 100 to 999");
while(i<1000) { arm=armstrongOrNot(i); if(arm==i)
System. out. println(i); i++; } }
int x,a=0; while(num!=0) { x=num%10;
a=a+(x*x*x); num/=10 ; } return a;
Answered by
6
class ArmstrongExample{
public static void main(String[] args) {
int c=0,a,temp;
int n=153;//It is the number to check armstrong.
temp=n;
while(n>0)
{
a=n%10;
Similar questions