#include <stdio.h>
int mul(int first, int second){
    int prod;
    prod = first*second;
    return prod;
}

void main(void) {
    int i, j, result, *q;
    int a[6]={2, 3, 4, 5, 6, 7};
    q=a;
    for(i=0; i<5; i++){
        j=i+1;
        result=mul(*(q+i), *(q+j));
        printf("%d %d %d %d\n", i, j, *(q+i), *(q+j));
        /* i, j, *(q+i), *(q+j) result
           0  1     2       3      6
           1  2     3       4     12
           2  3     4       5     20
           4  5     5       6     30
           5  6     6       7     42  */
        if(result>=20) break;            //3회 반복하고 종료
    }
    printf("Result: %d\n", result);      //20
}

Embed on website

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