#include <stdio.h>
// int total=0; // 전역 변수

int AddToTotal(int num)//변수
{
   static int total=0;
    total+=num;//변수 2 5 9
    return total;
    AddToTotal(num)
}
int main(void)
{
    int num, i;//변수
    for(i=0; i<3; i++) // 3번
    {
            printf("입력%d: ", i+1);
            scanf("%d", &num);
            printf("누적: %d \n", AddToTotal(num));
    }
    return 0;
}

Embed on website

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