Skip to content

mv1014/Displaying-matrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

//DISPLAYING A MATRIX TAKEN FROM THE USER #include<stdio.h> #include<string.h> int main(){

int i,j,r,c;
printf("Write the number of rows : \n");
scanf("%d",&r);
printf("Write the number of columns : \n");
scanf("%d",&c);
int a[r][c];
printf("Write the numbers of the matrix : \n");
for(i=0;i<r;i++){
    for(j=0;j<c;j++){
        printf("Enter the values for a[%d][%d] : \n",i+1,j+1);
        scanf("%d",&a[i][j]);
    }
    if(j==c){
        printf("\n");
    }
}
printf("The matrix entered by the user is : \n");
for(i=0;i<r;i++){
    for(j=0;j<c;j++){
        printf("%d ", a[i][j]);
    }
    printf("\n");
}
return 0;

}

About

taking the input of the elements of a matrix and displaying the matrix correctly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors