https://www.acmicpc.net/problem/1292


#include <stdio.h>

int main (void){

int a, b; scanf("%d%d", &a, &b);

int arr[1005] = {};

int iter = 1, num = 1;

while (1){

for (int i = 0; i < num; ++i){

if (iter > 1000) goto swit;

arr[iter++] = num;

}

num++;

}

swit:


int result = 0;

for (int i = a; i <= b; ++i){

result += arr[i];

}

printf("%d\n", result);

return 0;

}



1292.c:15:2: error: expected expression

        int result = 0;

        ^

1292.c:17:3: error: use of undeclared identifier 'result'

                result += arr[i];

                ^

1292.c:19:17: error: use of undeclared identifier 'result'

        printf("%d\n", result);

                       ^

<style type="text/css"> p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier; color: #933a21; background-color: #dfdbc3} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier; color: #4d2f2d; background-color: #dfdbc3} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Courier; color: #00a400; background-color: #dfdbc3} span.s1 {font-variant-ligatures: no-common-ligatures} span.s2 {font-variant-ligatures: no-common-ligatures; color: #b12513} </style>

3 errors generated.




goto문으로 while 나오고 int 선언 하는데 왜 에러가 뜨는지요?