Hi. I am learning C programming language. I practice different program but I am little bit confuse in code for Armstrong number. Please explain me how’s the code work with suitable example. All possible replies and suggestions are appreciated.
Hi. I am learning C programming language. I practice different program but I am little bit confuse in code for Armstrong number. Please explain me how’s the code work with suitable example. All possible replies and suggestions are appreciated.
I suggest you to refer following example of Armstrong number, which will give you something idea about the use of this:
Code:void main() { int n,b=0,t; clrscr(); printf(“Enter the no”); scanf(“%d”,&n); t=n; while(n>0) { a=n%10; b=b+a*a*a; n=n/10; } if(b==t) { printf(“Armstrong no”); } else { printf(“Not an Armstrong no”); } getch(); }
Bookmarks