top of page
shishantpandey

HOW TO FIND ARMSTRONG NUMBER

Updated: Aug 18, 2022



#include <stdio.h>

#include <math.h> int main() { // An Armstrong number is a n digit number, which is equal to the sum of the nth powers of its digits. All the 1 digit numbers (1-9) are Armstrong number because 1*1=1 which is equals to number (1) itself, 2*1=2 which is equals to number (2) itself so on for a


ll the 1 digit numbers (1-9). There are no 2 digit Armstrong numbers. // example of arm strong // 370=3,7,0 // 371 = 3,7,1 // 407=4,0,7





 

int a; int b;


int c; printf("enter first number \n"); scanf("%d", &a); printf("enter second number \n"); scanf("%d", &b); printf("enter third number\n"); scanf("%d", &c); int d, e, f; d = a * a * a; e = b * b * b; f = c * c * c;


int g = d + e + f; printf("\n%d", d);


printf("\n%d", e); printf("\n%d", f); printf("\n%d", g); if (g == 100 * a + 10 * b + 1 * c) { printf("\n it is an arm strong number"); } else { printf("\n it is not an arm strong number"); }


return 0; }




 

OUTPUT




enter first number

4



enter second number

0

enter third number

7


64

0

343

407

it is an arm strong number


4 views0 comments

Recent Posts

See All

Comments


Post: Blog2_Post
bottom of page