MIPI_BaseC_WebinarFRTK/22_Seminar09/05_sum_p14.c
2024-11-13 09:22:28 +03:00

19 lines
274 B
C

#include <stdio.h>
int sum(int a[], int size)
{
int i, s=0;
for(i=0;i<size;i++)
s+=a[i];
return s;
}
int main()
{
int a[5] = {10,20,30,40,50};
printf("%d\n",sum(a,5));
printf("%d\n",sum(a,2));
printf("%d\n",sum(a+2,3));
return 0;
}