Advertisement
ripper2hl

arreglos bidimensionales

Jun 9th, 2012
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.  int x,y,i,j;
  5. printf("Cuantas filas tendra el arreglo?");
  6. scanf("%d",&x);
  7. printf("cuantas columnas tendra el arreglo");
  8. scanf("%d",&y);
  9. int arreglo[x][y];
  10. for(i=1;i<=x;i++)
  11. {
  12.   for(j=1;j<=y;j++)
  13.   {
  14.     printf("Cual sera el valor del arreglo en la posicion %d - %d ",i,j);
  15.     scanf("%d",&arreglo[i][j]);
  16.    }
  17.  }
  18. printf("\n\n\tIMPRESION DEL ARREGLO\n");
  19. for(i=1;i<=x;i++)
  20. {
  21.    for(j=1;j<=y;j++)
  22.    {
  23.      printf("\nValor del arreglo en la posicion %d - %d es: ",i,j,arreglo[i][j]);
  24.     }
  25. }
  26. printf("\n\n\tIMPRESION DEL ARREGLO EN FORMA DE MATRIZ\n");
  27. for(i=1;i<=x;i++)
  28. {
  29.      for(j=1;j<=y;j++)
  30.      {
  31.        printf("\t %d ",arreglo[i][j]);
  32.       }
  33. printf("\n");
  34. }
  35. getch();
  36. return (0);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement