-
Notifications
You must be signed in to change notification settings - Fork 0
/
13. Two Dimentional array (CSE425- Assignment 1)..c
71 lines (56 loc) · 1.31 KB
/
13. Two Dimentional array (CSE425- Assignment 1)..c
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <stdio.h>
#include <math.h>
float circleArea(float r);
float circlePerimeter(float r);
int main(void)
{
int arr[5][5], i,j,k;
float *r;
float area;
float perimeter;
r= *arr;
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
printf("Enter the values in the array [%d] [%d]:", i,j,r);
scanf("%d", &arr[i][j]);
}
}
//To display
printf("The array elements are: \n");
for(i=0;i<5; i++)
{
//printf("\n");
for(j=0;j<5;j++)
{
printf("%d", arr[i][j]);
}
printf(" \n");
}
//The code snippet below are for user defined function. But, these code don't show results properly.
//Thus, they are commented out.
/*for(k=0;k<25;k++)
{
printf("Area of the circle: %f", cicleArea(r));
printf("\n");
}
for(k=0;k<25;k++)
{
printf("Perimeter of the circle: %f", ciclePerimeter(r));
printf("\n");
}*/
return 0;
}
float circleArea(float r)
{
float area;
area= 3.14 * r * r;
return area;
}
float circlePerimeter(float r)
{
float perimeter;
perimeter = 2* 3.14 * r;
return perimeter;
}