Q:

Avoid last loop iteration

I built a simple function that, given an integer, returns every smaller square. Es:
input: 80
output:
1
4
9
:
64

So I tried with a while and a do..while loop:
int main(){
    int x;
    int y = 0;
    int z = 0;
    while(x < 1){
            printf("Insert an integer number greater than 0\n");
            scanf("%d", &x);
    }                                     #approach with do..while
    while(z <= x){                        #do{
            y += 1;                           
            z = y * y;
                printf("%d\n", z);
    }                                     #}while(z < x)
return 0;
}

My output goes up to:
    input: 80
    output:
    1
    4
    :
    81

How can I make the loop avoid the last iteration, since the condition z <= x will be true only then, actually producing a non valid output?

A:

just say 
int x = 0;
int z = 1;
int y = 1;

at the beginning, and
printf("%d\n", z);
y += 1;                           
z = y * y;

in the loop
EDIT: problem is the order of your statement. You print first and check later.
Complete answer is below:
int main(){
    int x = 0;
    int y = 1;
    int z = 1;

    while(x < 1){
            printf("Insert a positive integer number greater than 0\n");
            scanf("%d", &x);
    }                                     //approach with do..while
    while(z <= x){                        //do{
            printf("%d\n", z); 
            y += 1;                           
            z = y * y;
    }                                     //}while(z < x)
return 0;
}

