#include <stdio.h> #include <malloc.h> float soma (float v[], int dim) { float s = 0.0; int n; for(n = 1; n <= dim; n++) { s += v[n - 1]; } return s; } void main () { int num, n; float* v; printf("\ndigite o numero de pontos: "); scanf("%d", &num); v = malloc(num * sizeof(float)); for(n = 1; n <= num; n++) { printf("\n valor de v%d: ", n); scanf("%f", &v[n - 1]); } printf("\nSoma = %f", soma(v, num)); }