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

13y ago

What else can I help you with?

Continue Learning about Engineering

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"); } }


How do you check if your ohm meters resistance is working properly?

Get some resistors of known values and check your meter with them.


How do you write a program to print Armstrong numbers between 1 and 100 using for loop?

/*Program to find Armstrong number between 1 to N*/ int main() { int n = 0, remainder, sum = 0, i = 0, noDigits = 0, isArm = 0; char ch[60] = {0}; printf("Find the Arm Strong Numbers between 1 to N"); scanf("%d", &amp;n); for(i = 1; i&lt;n; i++) { isArm = i; itoa(isArm, ch, 10); noDigits = strlen(ch); while(isArm) { remainder = isArm%10; isArm=isArm/10; sum= sum+pow(remainder, noDigits); } if(sum == i) printf("\nArm Strong Nos are %d\n", i); sum = noDigits = 0; } }


A flowchart to Accept three numbers and check whether it firms to Pythagorean triplet?

Accept 3 natural numbers and check whether it firms pythagorean triplet

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;


How old is bllie joe Armstrong?

i think he is 36. check wikipedia.


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 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.


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


How can you use Javascript to identify the largest of three numbers using forms and buttons?

You will need to make a form with the following: - three input fields with IDs for the three numbers. Alternatively you may use one input and ask the user to separate the numbers with commas. - a button Let the button execute a function when clicked. This function will get the input fields' values using getElementById, check whether they are really numbers and then compare them. If you used the one textfield alternative, you will have to get the value, explode it at the commas and then check whether the values are correct and compare the numbers. As for comparing there are several possibilities. You could make decision trees with if-constructs or subtract the numbers from each other and check whether the result is &gt;0. Then you could display the result in a previously empty p- or div-element.


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