I had to create a c code that gets a number, returns how many digits it has,the digits sum, the digits product, to check if the digits sum is equal to product if yes return "1" else return 0, and in the end write a program the prints the first 20 numbers that the sum of their digits equals to the product. however in the end my program just prints the numbers 0-19. i know the problem must be in my while loop but i cant spot it can someone help me. my code is below:

#include <stdio.h>
#include <math.h>
#define r 10

int get_nums(int a) //(gets an integer number and returns how many digits it has)

{
int nums,p,q;

p=10;
q=a/p;
nums=1;

while(a/p!=0)
{
p=pow(r,nums);
a=q;
nums++;
}
return nums;
}

int get_sum(int a) // (gets an inter number and returns the sum of its digits)

{
int sum,nums,p,q;

nums=get_nums(a);
sum=0;
for(p=0;p<nums;p++)
{
q=a%r;
a=a/r;
sum+=q;
}
return sum;
}

int get_product(int a) //( get an integer number and returns the product of its digits)

{
int p,sum,nums,q,product;

nums=get_nums(a);

for(p=0;p<nums;p++)
{
q=a%r;
a=a/r;
product*=p;

}
return product;
}

int check_num(int a) //(gets a number checks if the product of its digits is equal to the some if its is return 1 otherwise return 0)

{
int p,sum,nums,product;

nums=get_nums(a);
sum=get_sum(a);
product=get_product(a);

if(product==sum)
{
return 1;
}
else
{
return 0;
}
}

main()
{
int a,sum,product,check,nums,i;

a=0;
i=0;
nums=get_nums(a);
sum=get_sum(a);
product=get_product(a);
check=check_num(a);


while(check == 1)
{
printf("%6d",a);
a++;
i++;
if(i==20)
{
break; // (after 20 numbers are printed the loop should be exited)
}
}
while (check!=1)
{
a++;
continue; //( if check !=1 increase a by one and check for the next integer).
}
printf("\n");
}