Categories




C program to read 2D array size of 2*3 from user and display it

Program to read a matrix of size 2*3  from user and display it in matrix form.

Note: If you are a beginner in programming then I recommended you to visit the following topics, which make you easy to understand this programming easily.

String Function
Array and Type’s
Switch Case
*  Function


Algorithm
1.      START
2.      for (i=1; i<=2; i++)
3.      for (j=1; j<=3; j++)
4.      Read A[i][j]
5.      for (i=1; i<=2; i++)
6.      for (j=1; j<=3; j++)
7.      Display “A[i][j]”
8.      END
Flowchart
C program to read 2D array size of 2*3 from user and display it 
 

 

 #include<stdio.h>  
#include<conio.h>  
 int main ()
{
    int i, j, A[2][3];
    for (i=1; i<=2; i++)
    {
        for (j=1; j<=3; j++)
        {
printf ("Enter the element of matrix A[%d][%d]:", i, j);
scanf ("%d", &A[i][j]);
        }
    }
printf ("nMatrix A:n");
    for (i=1; i<=2; i++)
    {
        for (j=1; j<=3; j++)
        {
printf ("%dt", A[i][j]);
        }
printf ("n");
    }
getch ();
    return 0;
}

OUTPUT:

SIMILAR POST
 

 

Loading...

admin

Leave a Reply

Your email address will not be published. Required fields are marked *