Create a Dynamic Matrix using C Program
Code:
#include<stdio.h>
void main(){
int a[100][100],r,c,i,j;
printf("enter row and colume :");
scanf("%d%d", &r,&c);
printf("enter matrix element : \n");
for(i=0;i<r;i++){
for(j=0;j<c;j++){
scanf("%d", &a[i][j]);
}
}
for(i=0;i<r;i++){
for(j=0;j<c;j++){
printf("%d", a[i][j]);
if(j==c-1){
printf("\n");
}
}
}
}
void main(){
int a[100][100],r,c,i,j;
printf("enter row and colume :");
scanf("%d%d", &r,&c);
printf("enter matrix element : \n");
for(i=0;i<r;i++){
for(j=0;j<c;j++){
scanf("%d", &a[i][j]);
}
}
for(i=0;i<r;i++){
for(j=0;j<c;j++){
printf("%d", a[i][j]);
if(j==c-1){
printf("\n");
}
}
}
}
Comments
Post a Comment