#include <stdio.h>
int SomaPositivos(int vet[], int n)
{
if (n >= 0)
{
return (vet[n-1] > 0 ? vet[n-1] : 0) + SomaPositivos(vet, (n-1));
}
return 0;
}
int main(void)
{
int v[20] = {2, 1, 8, 3, 4, - 5};
int a;
a = SomaPositivos(v, 6);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgU29tYVBvc2l0aXZvcyhpbnQgdmV0W10sIGludCBuKSAgCnsKCWlmIChuID49IDApCgl7CgkJcmV0dXJuICh2ZXRbbi0xXSA+IDAgPyB2ZXRbbi0xXSA6IDApICsgU29tYVBvc2l0aXZvcyh2ZXQsIChuLTEpKTsKCX0KCXJldHVybiAwOwp9CgoKaW50IG1haW4odm9pZCkgCnsKCWludCB2WzIwXSA9IHsyLCAxLCA4LCAzLCA0LCAtIDV9OwogICAgaW50IGE7CgogICAgYSA9IFNvbWFQb3NpdGl2b3ModiwgNik7CiAgICBwcmludGYoIiVkICIsIGEpOwoKICAgIHJldHVybiAwOwp9Cg==