I have been staring at this program for school which is supposed to be a dummy atm machine and I can't figure out why, but after the first run through of the program it closes automatically, right after you imput the second menu choice. Any help would be greatly appreciated.
Code:
#include <stdio.h>

int menu(){
int func_option;
func_option=0;
   
    printf("Transaction options: \n");
    printf("1 - Deposit funds (credit transaction) \n");
    printf("2 - Withdraw funds (debit transaction) \n");
    printf("3 - Print statement of account \n");
    printf("4 - Compute interest and exit \n");
    printf("Please indicate your option: \t");
    scanf("%d",&func_option);
    printf("\n %d",func_option);
    system("pause");
    return func_option;
}
int main()
{

int option, ctran, dtran, ttran;
float bal, change, minbal, interest, final;
    
option=menu();
bal=2000;
minbal=2000;
ctran=0;
dtran=0;
ttran=ctran+dtran;


if(option==1){
      printf("\nYour current balance is:\t $%.2f \n How much do you want to deposit?\n", bal);
      scanf("%f", &change);
      bal=bal+change;
      ctran=ctran+1;
      printf("Your current balance is:\t $%.2f\n\n", bal);
      return menu();
}
if(option==2){
        printf("\nYour current balance is:\t $%.2f\n", bal);
        printf("How much do you want to withdraw?\n");
        scanf("%f", &change);
        bal=bal-change;
        if(minbal>=bal){
        minbal=bal;}
        dtran=dtran+1;
        printf("Your current balance is:\t $%.2f\n\n", bal);
        return menu();
}
if(option==3){
        printf("\n Current Balace:\t $%.2f \n", bal);
        printf("Minimum Balance:\t $%.2f \n", minbal);
        return menu();
}
if(option==4){
        interest=minbal*(.035/12);
        final=interest+bal;
        printf("Statement of account:\n");
        printf("Credit Transactions: \t %d \n", ctran);
        printf("Debit Transactions: \t %d \n", dtran);
        printf("Current Balance: \t $%.2f \n", bal);
        printf("Minimum Balance: \t $%.2f \n", minbal);
        printf("Interest Computed: \t $%.2f \n", interest);
        printf("Final Balance: \t\t $%.2f \n", final);
        printf("Good Bye!\n\n");
}      


system("pause");
}