Created
September 4, 2012 13:41
-
-
Save gonzalowtf/3621255 to your computer and use it in GitHub Desktop.
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
// programa 1, arreglos, mostrar cuantas veces se repite en el arreglo un numero ingresado | |
#include<stdio.h> | |
void cargarvector(int, int[]); | |
int main(int argc , char*, int argv[]) | |
{ | |
int h,x,i, cont; | |
i=1; | |
cont =0; | |
printf("ingrese el orden del vector"); | |
scanf("%d", &h); | |
printf("ingrese el valor a buscar en el arreglo: "); | |
scanf("%d", &x); | |
int v[h]; | |
cargarvector(h, v); | |
for(i=1; i<=h;i++) | |
{ | |
if(x==v[i]) cont++; | |
} | |
printf(" la cantidad de veces que se repite en el arreglo son: %d",cont); | |
fgetc(stdin); | |
fgetc(stdin); | |
return 0; | |
} | |
void cargarvector(int h, int v[]) | |
{ | |
int i; | |
i=1; | |
for(i=1; i<=h; i++) | |
{ | |
printf("ingrese un valor para el vector: "); | |
scanf("%d", &v[i]); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment