I'm writing a problem to output all the prefect number which is less than 1million. But I have a little problem with hold all the numbers by using array. It only shows the first prefect number "6", so how to solve this problem. And here's my code:

Code:#include <stdio.h> #include <math.h> int x, b, k, y; int prefect(int b); void main () { printf("\nThis is a prefect number: %ld", prefect(b)); } int prefect(int b) { if(b<1000000) { if(k = 1, k <= 9, k++) { x=pow(2, k-1); y=pow(2, k); } b = x * (y-1); } return b; }