Skip to content

Instantly share code, notes, and snippets.

@gonzalowtf
Created September 11, 2012 12:52
Show Gist options
  • Save gonzalowtf/3698223 to your computer and use it in GitHub Desktop.
Save gonzalowtf/3698223 to your computer and use it in GitHub Desktop.
// programa 5,
#include<stdio.h>
void cargarvector(int, int[]);
int main( int argc, char* argv[])
{
int c, n, i , r, z, v[n];
printf("ingrese el orden del vector: ");
scanf("%d", &n);
printf("\n ingrese el valor de la constante : ");
scanf("%d", &c);
cargarvector(n, v);
i=1;
r=1;
for(i=1; i<=n;i++)
{
z=v[i] -c;
r*=z;
}
printf(" ********* %d************ \n es el nuimero resultante",r);
fgetc(stdin);
fgetc(stdin);
return 0;
}
void cargarvector(int n, int v[])
{
int i;
while(i<=n)
{
printf("ingrese un valor para el vector: ");
scanf("%d", &v[i]);
i++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment