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
Armstrong Number In C
Shobana J
Jul 13, 2016
31.9
k
0
4
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
In this blog, you will learn about Armstrong number in C.
arm.zip
Introduction
In this blog, I am going to explain Armstrong number. It is nothing but "An Armstrong number of the three digits is an integer, such that the sum of the cubes of its digits is equal to the number itself ".
Software Requirement
Turbo C++ OR C.
Programming
#include < stdio.h >
#include < stdlib.h > int main()
{
int
a, n, b = 0, t;
printf(
"Enter the no:"
);
scanf(
"%d"
, & n);
t = n;
while
(n > 0)
{
a = n % 10;
b = b + a * a * a;
n = n / 10;
}
if
(b == t)
{
printf(
"its an armstrong number"
);
}
else
{
printf(
"its not an armstrong number"
);
}
getch();
return
0;
}
Explanation
In the programming, given above, it is clearly understood that Armstrong number is a number which is equal to the sum of the digits, raised to the power and the total number of the digits in the number.
Output
Conclusion
Thus the Armstrong number is clearly explained and executed successfully.
Armstrong Number
C
Next Recommended Reading
Find The GCD Of Any Two Numbers