79438341

Date: 2025-02-14 04:07:57
Score: 0.5
Natty:
Report link

This answer uses the most brute-force while loop. The result is in summation.

a=c(1,2,-1,3,1,0)
n=length(a)
i=1
sum=0
summation=0
while(i<=n){
if (a[i]>=0){
sum=sum+a[i]
}
summation[i]=sum
i=i+1
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Asigan