Search
  • Soumen(ADMIN)

Matrix Input using Array in C

Updated: Aug 26


#include<stdio.h>


int main() {


int a[20][20];

int i, j, m, n;


printf("please enter the row and column number: ");

scanf("%d %d",&m,&n);

for(i=0;i<m;i++) {

for(j=0;j<n;j++) {

printf("\n Please enter a(%d,%d) th element :",i,j);

scanf("%d",&a[i][j]);

}

}

printf("\n Given matrix : \n");

for(i=0;i<m;i++) {

for(j=0;j<n;j++) {

printf("%d\t",a[i][j]);

}

printf("\n");

}

}


please enter the row and column number: 2 3


Please enter a(0,0) th element :1


Please enter a(0,1) th element :2


Please enter a(0,2) th element :3


Please enter a(1,0) th element :4


Please enter a(1,1) th element :5


Please enter a(1,2) th element :6


Given matrix :

1 2 3

4 5 6


--------------------------------

Process exited after 16.56 seconds with return value 2

Press any key to continue . . .

16 views

Recent Posts

See All

Bisection Method in C

#include<stdio.h> #include<stdlib.h> #include<math.h> #define f(x) (x*x*x - x - 1) int main() { float x0,a,b; int k; float e = .001; do{ printf("please enter the value of a and b : "); scanf("%f%f",&a

Bubble Sort in C

//bubble sort #include<stdio.h> #include<conio.h> int main() { int n,i,j,temp; int arr[n]; printf("please enter how many number do you want to put?"); scanf("%d",&n); for(i=0;i<n;i++) { printf("\nente

Addition Of Two Numbers in C

#include<stdio.h> #include<conio.h> void main() { int a; int b; int c; printf("Please enter the first Number: "); scanf("%d",&a); printf("Please enter the second Number: "); scanf("%d",&b); c=a+b; pri

  • Facebook Social Icon

©2019 by WEBTONEXT