Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Armstrong Number In C
WhatsApp
Shobana J
8y
32.8
k
0
4
25
Blog
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
Up Next
Find The GCD Of Any Two Numbers
Ebook Download
View all
Printing in C# Made Easy
Read by 22.3k people
Download Now!
Learn
View all
Membership not found