what are you having problems with? From your code, I don't see any use for the while (1) never-ending loop. It would also return a wrong answer for subsequent tries because you are not "re-setting" the digits vector to zero after every iteration.
Be careful of the boundary conditions also.
Also, you are not returning anything from the main function.
i removed the while loop it wasnt the problem though....
i use code blocks so no need to return a value in main function
i checked the boundary conditions but it just keeps returning true for any number