PROBLEM BC106…i have written the right code which works on VSCODE on my system…and gives correct ans acc to sample input…but still codechef deems it as incorrect…WHY?
I AM ATTACHING MY CODE BELOW…pls help
//Long Long Sum Problem Code: BC106
#include
using namespace std;
int main()
{
int n;
long int arr[10];
cout<<"Enter number of elements of the array : ";
cin>>n;
long long int SUM=0;
cout<<“Enter the elements of the array:”<<endl;
for(int i=0;i<n;i++)
{
cin>>arr[i];
SUM+=arr[i];
cout<<endl;
}
cout<<"Sum of the elements of this array is : "<<SUM<<endl;
return 0;
}
You could have posted the problem link. But anyways, you should not print anything other than answer.
That is, delete the cout<<"Enter number of elements,
Also delete cout<<“Sum of elements is:”.
Just input and print SUM
thanks .it worked