forked from PrabhudeepSingh/C-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImplement2DArray.c
More file actions
50 lines (42 loc) · 831 Bytes
/
Implement2DArray.c
File metadata and controls
50 lines (42 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//Program to implement two dimensional array
#include<stdio.h>
int main()
{
int r,c,i,j;
float a[20][20];
printf("Enter the order of Matrix : \nRows : ");
scanf("%d",&r);
printf("Columns : ");
scanf("%d",&c);
while(r<=0||r>20)
{
printf("\nError... Range of Rows is 0 - 20 ");
printf("\nEnter the number of Rows again : ");
scanf("%d",&r);
}
while(c<=0||c>20)
{
printf("\nError... Range of Columns is 0 - 20 ");
printf("\nEnter the number of Columns again : ");
scanf("%d",&c);
}
printf("\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
printf("Enter the element at location a[%d][%d] : ",i,j);
scanf("%f",&a[i][j]);
}
}
printf("\nEntered matrix is : \n\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
printf("%.2f\t",a[i][j]);
}
printf("\n");
}
return 0;
}