TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
How To Create Armstrongnumber In Using Java
Muthuramalingam Duraipandi
Aug 12
2016
Code
519
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
muthu.ZIP
import
java.util.*;
class
ArmstrongNumber
{
public
static
void
main(String args[])
{
int
n,sum=
0
,temt,r;
Scanner in =
new
Scanner(System.in);
System.out.println(
"Enter a number to check if it is an armstrong number"
);
n=in.nextInt();
temp=n;
while
(temp !=
0
)
{
r=temp;
sum =sum+r*r*r;
temp = temp/
10
;
}
if
(n==sum)
System.out.println(
"Entered number is an armstrong number."
);
else
System.out.println(
"Entered number is not an armstrong number."
);
}
}
Armstrong Number
java