C Program:
#include<stdio.h>
main()
{
Information about resetting and configuring Mobile phones (Java, Android, Symbian etc), educational articles especially for programming in C, C++ and Java and more about Computers and operating systems
#include<stdio.h>
main()
{
#include<stdio.h>
long int factorial(int n)
{
#include<stdio.h>
#include<conio.h>
void main()
{
# include <iostream.h>
# include <conio.h>
# include <math.h>
void main ()
{
clrscr();
int a,b=0,sum=0;
long int n;
cout<<"Enter the number to be checked\n ";
cin>>n;
if(n<1)
{
cout<<"\nThe number should be greater than 0";
}
else
{
a=n;
//counting the digits
while (a>0)
{
a=a/10;
b++;
}
a=n;
//adding up bth power of digits
while(a>0)
{
sum=sum+pow(( a%10) ,b);
a=a/10;
}
if(sum==n)
cout<<"\nThe number is an ARMSTRONG number";
else
cout<<"\nThe number is NOT an ARMSTRONG number";
}
getch();
}
# include <stdio.h>
# include <conio.h>
# include <math.h>
void main ()
{
clrscr();
int a,b=0,sum=0;
long int n;
printf("Enter the number to check\n ");
scanf("%i",&n);
if(n<1)
{
printf ("\nThe number should be greater than 0");
}
else
{
a=n;
//counting the digits
while (a>0)
{
a=a/10;
b++;
}
a=n;
//adding up bth power of digits
while(a>0)
{
sum=sum+pow(( a%10) ,b);
a=a/10;
}
if(sum==n)
printf ("\nThe number is an ARMSTRONG number");
else
printf ("\nThe number is NOT an ARMSTRONG number");
}
getch();
}