#include <stdio.h>
#include <stdlib.h>


int main() {
    int f=5;
    int i=0;
int * a2 = (int *)malloc(sizeof(int)*5);
    while(1)
    {
        if(i>=f)
        {
            f=f+3;
            a2 = (int *)realloc(a2, sizeof(int)*f);
        }
        

        
            scanf("%d", &a2[i]);
            if(a2[i]==-1)
            {
                break;
            }
           
        i++;
    }
    for(int g=0; g<f; g++)
        printf("숫자%d: %d \n",g,a2[g]);
    free(a2);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: