Testcases 1,2,3 kyu fail ho ja rhae hai

#include <bits/stdc++.h>

using namespace std;
int c=0;
void splitArray(int *arr, int i, int sum1, string &s1, int sum2, string &s2,int n,vector&ans)
{

if(i==n)
{
    if(sum1==sum2)
    {  c++;
        cout<<s1<<" and "<<s2<<endl;
    }
    

    return;
}
   s1.push_back(arr[i] + '0' );
   //s1=s1 + " " + arr[i];

    splitArray(arr,i+1,sum1+arr[i],s1,sum2,s2,n,ans);
    s1.pop_back();
    
    s2.push_back(arr[i] + '0');
     // s2=s2 + " " + arr[i];
	splitArray(arr,i+1,sum1,s1,sum2+arr[i],s2,n,ans);
s2.pop_back();

}

int main()
{
int n;
cin>>n;
int arr[n];

for(int i=0;i<n;i++)
{
    cin>>arr[i];
}

int sum1=0;
int sum2=0;
string s1;

string s2;
vectorans;
//vectors1;
//vectors2;
splitArray(arr,0,sum1,s1,sum2,s2,n,ans);

cout<<c<<endl;
return 0;
}

hi @tarunkumar08yadav try this

6
10
1
1
1
2
15

it fails in more than 1 digit no
updated code --> https://ide.codingblocks.com/s/687946

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.