Getting sigcont error can any one explain why

#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cout.tie(NULL),cin.tie(NULL)
#define endl "\n"
#define ll long long
#define all(a) (a).begin(),(a).end()
#define repp(i,a,b) for(int i = a;i<b;i++)
#define repn(i,a,b) for(int i = a;i<b;i++)

using namespace std;
int gcd(int a, int b) 
{ 
	if (a == 0) 
		return b; 
	return gcd(b % a, a); 
} 

int findNumber(int arr[], int n) 
{ 
	// Find GCD of array 
	int ans = arr[0]; 
	for (int i = 0; i < n; i++) 
		ans = gcd(ans, arr[i]); 

	return ans; 
} 


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int Times;
    cin>>Times;
    while(Times--)
    {
        int n;
        cin>>n;
        int arr[n];
        repp(i,0,n)
        {
            cin>>arr[i];
        }
        int ab = findNumber(arr,n);
        if (ab>1)
        repp(i,0,n){
            arr[i] = arr[i]/ab;
        }
        
        repp(i,0,n)
        {
            cout<<arr[i]<<" ";
        }
          
        cout<<endl;
    }
    
    return 0;
}

Please either format your code or link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

Also, please tell us which Problem it is you’re trying to solve - I’m guessing it’s RECIPE?

2 Likes

yes the problem is RECIPE

I just submitted your code.

1 Like

#include <bits/stdc++.h>
using namespace std;

int main() {
// your code goes here
int T;

//stds to make cin cout fast
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> T;
cin.ignore(numeric_limits<streamsize>::max(), '\n');

//querries
while(T--){
int arr[200],n,i=0,m=0;
//input number
cin >> n;
//checking boundary conditions
if(n==0 || n==1){
    printf("1\n");
}
else{
//cin.ignore(numeric_limits<streamsize>::max(), '\n');
//storing number into the array
for(int flag=n; flag!=0; flag/=10){
    arr[m++]=flag%10;
}

//calculate factorial
int carry;
//control loop
for(i=2; i<n; i++){
    carry=0;
    //loop for array control
    for(int j=0; j<m; j++){
        int x=(arr[j])*i+carry;
        arr[j]=x%10;
        carry=x/10;
    }

    //pushing carry into the array
    for(carry; carry>0; carry/=10){
        arr[m++]=carry%10;
    }
}
//printing answer
for( i=m-1; i>=0; i--)
    {cout << arr[i];}
cout << endl;
}
}

return 0;

}

//I am also getting the same error. Any reasons??