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
Identify The Given Number Is Armstrong Number Or Not In C#
Vijayaragavan S
Aug 27
2016
Code
947
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
using
System;
class
Armstrong {
static
void
Main() {
int
number, remainder, sum = 0;
Console.Write(
"enter the Number"
);
number = Convert.ToInt16(Console.ReadLine());
for
(
int
i = number; i > 0; i = i / 10) {
remainder = i % 10;
sum = sum + remainder * remainder * remainder;
}
if
(sum == number) {
Console.Write(
"Given Number is an Armstrong Number"
);
}
else
Console.Write(
"Given Number is not an Armstrong Number"
);
Console.ReadKey();
}
}
Armstrong Number
C#