answersLogoWhite

0


Best Answer

<html>

<head>

<Script Language="JavaScript">

var a,n,b=0,t;

n=parseInt(window.prompt("enter n","0"));

t=n;

while(n>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");

}

</script>

</head>

</html>

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Program to check whether the given number is an Armstrong number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a program By using if else statement to read a number and check whether it is positive or negative?

write a c++program by using if statement to read a number and check whether it is positive or negative


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


Lab manual in mca 1st sem from ignou?

write a program in C to check whether a given number is apalindrome or not


Could you write a assembly language program in tasm To check whether a given number present in a sequence of given memory location containing the string to be checked in 8086?

8086 assembly language program to check wether given number is perfect or not


What is a Desk check trace table?

Going through a program on paper to check whether it has errors.


To check whether the given number is an Avogadro number or not?

45


How do you write a C program to check whether the number is odd or even Ps-using DEV complier?

To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.


Write a c program using while loop to accept a number check and display message whether number is perfect or not?

The program is here guys.......... //Finding whether the given number is perfect or not //Starts here #include&lt;stdio.h&gt; void main() { int i=1,temp=0,number; scanf("%d",&amp;number); while(i&lt;=number/2){ if(number%i==0) temp+=i; i++; } if(temp==number) printf("Its a perfect number"); else printf("Its not a perfect number"); } //ends here


How do you check whether a number is a square number?

if it's square root is an integer, it is a square number.


Why doesn't Canada recognize the number 13?

Where do you get that idea? Who doesn't recognize the number 13? Better check whether Canada does, or does not, recognize this number, instead of just assuming such an improbable situation.Where do you get that idea? Who doesn't recognize the number 13? Better check whether Canada does, or does not, recognize this number, instead of just assuming such an improbable situation.Where do you get that idea? Who doesn't recognize the number 13? Better check whether Canada does, or does not, recognize this number, instead of just assuming such an improbable situation.Where do you get that idea? Who doesn't recognize the number 13? Better check whether Canada does, or does not, recognize this number, instead of just assuming such an improbable situation.


Can you write a C program to check whether a string is an IP address or not?

Use the Exception class and type converters.