Programs in C language
5. Program to find whether the given number is Armstrong or not.#include<stdio.h> void main() { int n, n1, r, sum=0; clrscr(); printf("Enter a number:"); scanf("%d",&n); n1 = n; while(n>0) { r = n%10; sum=sum+(r*r*r); n = n/10; } if(n1 == sum) printf("Armstrong number"); else printf("Not a Armstrong number"); getch(); }Input :
153
Output :
Armstrong number
Father of C Language
Died: October 9, 2011, Murray Hill
Dennis Ritchie
Born: September 9, 1941, BronxvilleDied: October 9, 2011, Murray Hill