Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

7. Easy program to print armstrong number in c using while loop

C
O
D
E

ARMSTRONG NUMBER IN C PROGRAM:

#include<stdio.h>
int main()
 {
   int i=1,a,b,c;
    while(i<=500)
    {
    a=i%10;
    b=i%100;
    b=(b-a)/10;
    c=i/100;
    if((a*a*a)+(b*b*b)+(c*c*c)==i)
   {
   printf(“armstrong number=%d\n”,i);
   }
   i++;
   }
    return 0;
}

OUTPUT:

armstrong number=1
armstrong number=153
armstrong number=370
armstrong number=371
armstrong number=407

Table of Contents

P R O G R A M M I N G

Armstrong number in c program
Armstrong number in c program using while loop

E X E C U T E

Armstrong number in c program using
execute of Armstrong number in c program using while loop

E X P L A N S T I O N

Leave a Comment