question with for loop

+1 dipayan biswas · June 25, 2015
someone please help me ....how to write a program in c the check whether the is Armstrong or not.

Post a Reply

Replies

Oldest  Newest  Rating
+2 William Frost · June 26, 2015
I am sorry, what?
0 eng smart · June 30, 2015
is the armstrong number like this 23432 ?
0 Ash Marz · June 30, 2015
could you elaborate the question?
0 Aju Antony · July 1, 2015
#include 
void main()
{
int n, t, r, s=0;
printf("Enter a positive  integer: ");
scanf("%d", &n);
t=n;
while(t!=0)
{
r=t%10;
s+=r*r*r;
t/=10;
}
if(s==n)
printf("%d is an Armstrong number.",n);
else
printf("%d is not an Armstrong number.",n);
}
  • 1

C

107,029 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator