answersLogoWhite

0

import java.io.*;

public class Arms

{

public static void main(String args[]) throws Exception

{

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

System.out.println("Enter the number to be printed: ");

int n=Integer.parseInt(br.readLine());

int num,sum,r,temp;

System.out.println("Armstrong numbers upto given limit are:\n");

for(num=1;num<n;num++)

{

temp=num;

sum =0;

while (temp!=0)

{

r=temp%10;

sum=sum+(r*r*r);

temp=temp/10;

}

if(sum==num)

{

System.out.println(num);

}

}

}

}

Regards

Ramakrishna Nallapati

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

To find Armstrong number in java?

/*Program to find whether given no. is Armstrong or not. Example : Input - 153 Output - 1^3 + 5^3 + 3^3 = 153, so it is Armstrong no. */ class Armstrong{ public static void main(String args[]){ int num = Integer.parseInt(args[0]); int n = num; //use to check at last time int check=0,remainder; while(num &gt; 0){ remainder = num % 10; check = check + (int)Math.pow(remainder,3); num = num / 10; } if(check == n) System.out.println(n+" is an Armstrong Number"); else System.out.println(n+" is not a Armstrong Number"); } }


Write a java program to check a number is Armstrong number?

import java.io.*; public class Jerry { public static void main(String as[]) throws IOException { int k=Integer.parseInt(as[0]); int n=k; int d=0,s=0; while(n&gt;0) { d=n%10; s=s+(d*d*d); n=n/10; } if(k==s) System.out.println("Armstrong number"); else System.out.println("not Armstrong number"); } }


Shell program for gcd of three given numbers?

write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html


What are the values of two numbers when their product is -168.75 and their sum is 1?

-12.5 and 13.5 Check: -12.5*13.5 = -168.75 and -12.5+13.5 = 1


Program to check whether the given number is an Armstrong number?

&lt;html&gt; &lt;head&gt; &lt;Script Language="JavaScript"&gt; var a,n,b=0,t; n=parseInt(window.prompt("enter n","0")); t=n; while(n&gt;0) { a=n%10; b=b+a*a*a; n=n/10; } if(b==t) { document.writeln("Armstrong no"); } else { document.writeln("Not an Armstrong no"); } &lt;/script&gt; &lt;/head&gt; &lt;/html&gt;


What is the colt 3rd generation pistol serial numbers made in 2000 through 2011?

You will have to call Colt for anything after @ 2003. Check Blue Book of Gun values.


How old is bllie joe Armstrong?

i think he is 36. check wikipedia.


How do you program fax numbers in one-touch dialing?

That depends on the specific make and model of your fax machine. Check your user's manual, or look on the manufacturer's website.


Which program would you run to check for possible disk errors and where is the program located?

program would you run to check for possible disk errors


Numbers printed at the bottom of a check are called?

what are the numbers at the bottom of a check called


i need a completly free vin check program?

i need a completly free vin check program


What is a C program to generate prime no?

not sure of the exact syntax but its quite hard to generate them, but you can go through a list of numbers, that could be 0-10000000 say, and check if it is prime by dividing it by all the numbers that are smaller than it