I'm trying to check whether or not the number provided by the user is an [armstrong number](http://everything2.net/index.pl?node_id=1407017&displaytype=printable&lastnode_id=1407017). Something is wrong though and I can't figure it out.

Any help is appreciated.

Code attached below.

```
#include<stdio.h>

int fun(int);

int main()
{
    int x,a,b,y=0;

    printf("enter the number you want to identify is aN ARMSTRONG OR NOT:");
    scanf("%d",&a);

    for(int i=1 ; i<=3 ; i++)
    {
        b = a % 10;
        x = fun(b);
        y = x+y;
        a = a/10;
    }

    if(y==a)
        printf("\narmstrong number");
    else
        printf("\nnot an armstrong number");

    return 0;
}

int fun(int x)
{
    int a;
    a=x*x*x;
    return (a);
}

```