---
# System prepended metadata

title: Question

---

# Question



**問題:for loop or self defined function**


1.輸入3代表輸入3組數字後loop就結束了，但是現在執行卻無法結束

2.把what函式隱藏之後，問題就解決了，但是解除隱藏並在函式之前加入一個printf再執行，卻沒有顯示printf，所以推論根本還沒讀到函式就開始錯亂了。

**input:3,  1,2    1,2      1,2.....**

```
#include <stdio.h>
void what(int n,int digit[], int origin[]);

int main(void)
{
    //scanf checked!

    int n;
    scanf("%d", &n);
    int origin[n];
    int digit[n];

    for(int i =0 ; i < n ; i++)
    {
        scanf("%d", &digit[i]);
        scanf("%d", &origin[i]);
        printf("haha\n");
    }

    printf("???");
    what(n,digit,origin);
}


void what(int n,int digit[], int origin[])
{

    //origin will eventually become  wdtbs;

    int num1[n];
    int num2[n];
    int jump = 0;
    for (int i = 0 ; i < n ; i++)
    {
        num1[i] = 0;
        num2[i] = 0;
    }

    for (int i = 0 ; i < n ; i++)
    {
        jump = 0;
        for(; origin[i] > 0 || origin[i] != 3 || origin[i] != 5; origin[i] /= 10)
        {
            num1[i] += origin[i] % 10;
        }

        if (num1[i]%3==0||num1[i]%5==0)
        {
            jump++;
        }


        // use origin as temp;
        for (int i = 0 ; i < n ; i++)
        {
            origin[i] = num1[i];
        }


        if (jump = 0)
            for (; origin[i] > 0 || origin[i] != 3 || origin[i] != 5; origin[i] /=10)
            {
                num2[i] += origin[i] % 10;
            }
        else num2[i] = num1[i];


    }
    for (int i = 0 ; i < n ; i++)
    {

        printf("i=%d:", i);
        printf("it's num1 is: %d\n", num1[i]);
        printf("it's num2 is :%d\n",num2[i] );

    }

    return;

}

```