https://www.codechef.com/problems/FLOW018

#include
using namespace std;
int main()
{
int i ,n,j,a[3],k=2,fact[3];
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(j=0;j<3;j++)
{
fact[j]=a[j]*k;
k=fact[j];
cout<<fact[j]<<endl;

}
return 0;
}

It keeps on giving runtime error .can someone help please

Screenshot from 2021-05-19 12-44-35

I would appreciate if you could explain your code.

1 Like

I did this problem but in C language, I am attaching the solution for reference.
https://www.codechef.com/viewsolution/41661289

Hope it helps.