Hi,every one I am going to find whether the given number is a armstrong number or not and I have done my level best and I need your help in one thing,If any mistakes,please reply and I need your other views to develop my C skills.hope help from you all

thank you
vinaychalluru

Attachments
``````/*Program to find whether the given number is an armstrong number or not*/

armstrong number an example:135=1*1*1+3*3*3+5*5*5=135;

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main(0
{
int n,m,i,rem,sum=0;
printf("enter the number to be checked:");
scanf("%d",&n);
m=n;
while(n>0)
{
rem=n%10;
sum=sum+pow(rem,3);
n=n/10;
}
if(m==sum)
{
printf("the given number is an armstrong number");
}
else
printf("The given number is not an armstrong number");
getch();
}``````
6
Contributors
6
Replies
7
Views
10 Years
Discussion Span
Last Post by Narue

google will give you a lot of help, such as this one.

hope this helps u gettin final code...

``````eg:..to find 3 digit armstrong number:

void main()
{
int a,b,c,i;

printf("enter a 3 digit number\n");
scanf("%d",&i);

a=(i-(i%100))/100;
b=((i%100)-(i%10))/10;
c=i%10;
num=(a*a*a)+(b*b*b)+(c*c*c);
if(num==i)
printf("\nthis is armstrong");
getch();
}``````

Hi,
I have a soln for solving armstrong numbers

``````#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n,r,c,k;
clrscr();
printf("Armstrong numbers\n");
for(i=1;i<=500;i++)
{
c=0;
n=i;
k=n;
while(n!=0)
{
r=n%10;
c=c+(r*r*r);
n=n/10;
}
if(c==k)
printf("%d\n",k);
}
getch();
}``````

>hope this helps u gettin final code...
>I have a soln for solving armstrong numbers
I take solace in the fact that people who give away homework solutions usually come from the shallow end of the programmer pool. :icon_rolleyes:

hii narue