-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path14A04.c
49 lines (45 loc) · 841 Bytes
/
14A04.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
#include<stdio.h>
void main()
{
int Max;
int Min;
float Sum = 0;
float Avg;
int i;
int size;
int count=0;
printf("Enter size of array = ");
scanf("%d",&size);
int a[size];
for ( i = 0; i < size; i++)
{
printf("Enter number: ");
scanf("%d",&a[i]);
}
Max=a[0];
for ( i = 0; i < size; i++)
{
if (Max<a[i])
{
Max=a[i];
}
}
Min=a[0];
for ( i = 0; i < size; i++)
{
if (Min>a[i])
{
Min=a[i];
}
}
for(i=0;i<size;i++)
{
Sum=Sum+a[i];
count=count+1;
}
Avg=(Sum/count);
printf("Avg=%f\n",Avg);
printf("Sum=%f\n",Sum);
printf("Max=%d\n",Max);
printf("Min=%d\n",Min);
}