Skip to main content

2D Array in C

 

#include<stdio.h>
void main()
{
    int marks[10][10];
    int r, c;
    printf(" How many Row you want \n");
    scanf("%d",&r);
    printf("How many Colums you want \n");
    scanf("%d",&c);
    printf("Enter the matrix: ");
    for (int  i = 0; i < r; ++i)
    {
        for (int  j = 0; j < c; ++j)
        {
            printf(" ",i,j);
            scanf("%d",&marks[i][j]);
        }
                                       
    }
    printf("\nThe matirx is : \n");
    for (int  i = 0; i < r; ++i)
    {
        printf("\n");
       
        for (int  j = 0; j < c; ++j)
       
            printf("%d\t",marks[i][j]);
        }
       
    }  

       
   
   
   


Comments