ProgIng - Programación en Ingeniería
Loading...
Searching...
No Matches
Ejemplo038.c File Reference
#include <stdio.h>
#include <stdlib.h>
Include dependency graph for Ejemplo038.c:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 4 of file Ejemplo038.c.

5{
6 int r, c, i, j;
7 double *A;
8 do{
9 printf("Ingrese el numero de renglones: ");
10 scanf("%d", &r);
11 }while(r<1);
12 do{
13 printf("Ingrese el numero de columnas: ");
14 scanf("%d", &c);
15 }while(c<1);
16 A = (double*)malloc(r*c*sizeof(double));
17 if(A==NULL)
18 return 1;
19 for(i=0; i<r; i++)
20 for(j=0; j<c; j++)
21 {
22 printf("A[%d][%d] = ", i+1, j+1);
23// scanf("%lf", &A[c*i+j]);
24// scanf("%lf", &*(A+c*i+j));
25 scanf("%lf", A+c*i+j);
26 }
27 for(i=0; i<r; i++)
28 {
29 for(j=0; j<c; j++)
30 printf("%.4lf\t", A[c*i+j]);
31 printf("\n");
32 }
33 free(A);
34 return 0;
35}