C program to check a given number is Armstrong or not using function

This page has a C program to check a given number is Armstrong or not using function. The Armstrong is a number which belongs to integer. Armstrong Number is also known as Pluperfect digital invariant or Narcissistic number. In general, n-digits Armstrong number is equal to the sum of nth power of all digits of the n-digits number. For Example . . . 153 and 1634 are Armstrong numbers. That is, 1*1*1*+5*5*5+3*3*3 = 153, 1*1*1*1+6*6*6*6+3*3*3*3+4*4*4*4=1634 and so that the both two numbers are Armstrong numbers. The below given C program is used to check a given number is Armstrong or not using function. Kindly check out the program to check a given number is Armstrong or not using function. The program to check Armstrong or not can be written in many ways.

How will ask to check a given number is Armstrong or not using function

The question to find whether a Given Number is Armstrong Number or not using function can be asked as 1). Find out the Armstrong number using C program using function. 2). C program to verify whether the given number is Armstrong or not using function. 3). C program to find whether the given number is Armstrong or not using function. 4). C Program to check whether number is Armstrong or not using function. 5). C Program to check whether a number is Armstrong or not using function. 6). C program to check a given number is Armstrong number or not using function. 7). C Program to find entered number is Armstrong number or not 8). Program to find Armstrong or not using function. 9). Program to find Armstrong numbers using function. 10). Program to find a given number is Armstrong or not using function. 11). Program to find a number is Armstrong or not using function. 12). C program to check a number is Armstrong or not using function.

Program to check any Armstrong number using function

#include<stdio.h>

int armstrong(int);

int main(){

int numb,sum,entr;

clrscr();

printf("

Give an Integer number:

");

scanf("%d",&numb);

entr = numb;

sum = armstrong(numb);

if(sum == entr)

printf("

The Number %d is Armstrong ",entr);

else

printf("

The Number %d is not Armstrong Number",entr);

getch();

return 0;

}



int armstrong(int n){

int nr, digits=0, i, rem, s=0, m=1;

nr=n;

while(nr>0){

nr = nr / 10;

digits +=1;

}

nr=n;

while(nr!=0){

rem = nr % 10;

nr = nr / 10;

for(i=1;i<=digits;i++){

m = m*rem;

}

s +=m;

m=1;

}

return(s);

}