Created
October 7, 2018 17:42
-
-
Save LuisCusihuaman/84850d4494a545657112e354633cb6e5 to your computer and use it in GitHub Desktop.
ejemplo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define max_long 3 | |
/*void pedir_vector(int coord_ector[]);*/ | |
void imprimir_vector(int vector[]); | |
void sumar_vector(int vector_suma_a[], int vector_suma_b[], int vector_sumado[]); | |
int main(){ | |
int vector_a[max_long] = {1,2,3} | |
int vector_b[max_long] = {1,2,3} | |
int vector_resultado[max_long]; | |
/* pedir_vector(vector_a); | |
pedir_vector(vector_b); | |
*/ | |
sumar_vector(vector_a,vector_b,vector_resultado); | |
imprimir_vector(vector_resultado); | |
return 0; | |
} | |
/*void pedir_vector(int coord_vector[]){ | |
for (int i = 0; i < max_long; ++i){ | |
printf("Introduce la posicion %i: ",i+1); | |
scanf("%i",&coord_vector[i]); | |
} | |
}*/ | |
void imprimir_vector(int vector[]){ | |
for (int i = 0; i < max_long; ++i){ | |
printf("%i, ",vector[i]); | |
} | |
printf("\n"); | |
} | |
void sumar_vector(int vector_suma_a[], int vector_suma_b[], int vector_sumado[]){ | |
for (int i = 0; i < max_long; ++i){ | |
vector_sumado[i]= vector_suma_a[i] + vector_suma_b[i]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment