Q: using two arrays for prime number This is my school assignment.
Problem Statement:

"Write a program to print the prime numbers from 1 to 100.(A prime integer is any integer that can be divided evenly only by itself and 1).
Requirement: Use an array to take the number from 1 to 100 and another array to take the prime number."

Here's my code:
#include <stdio.h>
int main ()
{
    int x[100], a[100];
    int y, z;
    printf("here is an array going 1-100 :D\n");
    for (y=2; y<=100; y++){
            x[y]=y;
            printf("\n%d\n", x[y]);
            for (z=2; z<=y; z++){
                a[z]=z;
                if (a[z]%z==0){
                    break;
                }
            }
            if (z==a[z]){
               printf("\n%d is a prime number\n", a[z]);
            }
        }

    return 0;
}

I've been stumped on this for a bit. I've googled the question which usually solves my problem. But, I feel I'm close. Just having some trouble on my second array I believe.
Kindly guide me.

A: Please find correct answer as follows - 
#include <stdio.h>
int main ()
{
    int x[100], a[100];
    int y,z;
    z=0;
    x[0]=1;
    printf("here is an array going 1-100 :D\n");
    for (y=2; y<=100; y++){
            x[y-1]=y;
            printf("\n%d\n", x[y-1]);
            for (z=2; z<=y/2; z++){
                if (a[y-1]%z==0){
                    break;
                }
            }
            if (z>y/2){
               printf("\n%d is a prime number\n", x[y-1]);
               a[z++]=x[y-1];
            }
        }

    return 0;
}


A: #include <stdio.h>
int main ()
{
    int x[100], a[100]; //just declaring two arrays, although a[] has 100 elements i wont use them all
    int y, z;//these are for the counters that will be used in the for loop
    printf("here is an array going 1-100 :D\n");
    for (y=2; y<=100; y++){
            x[y]=y;//this will set the array to 1-100
            printf("\n%d\n", x[y]);//prints out said array
       for (z=2; z<=y; z++){

        if (y%z==0){//prime number test
             a[z]=z;//setting second array equal to prime number after it passes test
                break;
        }
       }
                       if (y==z){
               printf("\n%d is a prime number\n", a[z]);
            }
        }

    return 0;
}

