Oct 14, 2011

C Program to check the given number is Armstrong or not?

C Program to check the given number is Armstrong number or not?. Armstrong number is a number that is the sum of its own digits each raised to the power of the number of digits. Example: 153 = 1^3 + 5^3 + 3^3. Read more about C Programming Language .

/***********************************************************
* You can use all the programs on  www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
* 
*                      Happy Coding
***********************************************************/


#include<stdio.h>
void main()
{
 int num,num1,arms=0,rem;

 printf("Enter the number:\n");
 scanf("%d",&num);
 num1=num;
 while(num>0)
 {
  rem=num%10;
  arms=arms+rem*rem*rem;
  num=num/10;
 }
 if(num1==arms)
 {
  printf(" \n%d is an Armstrong number",num1);
 }
 else
 {
  printf("\n%d is NOT an Armstrong number",num1);
 }

} 
Read more Similar C Programs
Learn C Programming

Number System

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it


(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!