#include<stdio.h>; main() { int num,n,sum,r; clrscr(); printf("Enter a Number for Armstrong Check\n\n"); scanf("%d",&num); n=num; sum=0; while(n!=0) { r=n%10; sum=sum+r*r*r; n=n/10; } if(sum==num) printf("\n %d is an Armstrong no. \n",num); else printf("\n %d is not an Armstrong No.\n",num); }
Output----->
1 comment:
Thanks Dear....
Post a Comment