summaryrefslogtreecommitdiff
path: root/odev_7.c
blob: 2fd22637269a9bbb1953a85a779e6a9bef847fd2 (plain)
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
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int hwpri[5][4];
	float avgpri[5];
	int n = 2;

	for (int i = 0 ; i <= n; i++) {
		printf("you are in store %d\n",i);
		for (int i1 = 0; i1 <= 2 ; i1++ ) {
			printf("write the hardware %d's price: ",i1);
			scanf("%d", &hwpri[i][i1]);
			avgpri[i1] = avgpri[i1] + hwpri[i][i1];
		}
	}
	for (int i = 0 ; i <= n; i++){
		avgpri[i] = avgpri[i] / (n+1);
		printf("%d's price average: %f\n",i,avgpri[i]);
		for (int i1 = 0; i1 <= 2; i1++){

			printf(" Store %d's %d price is %d,thats ",i1,i, hwpri[i1][i]);
			if (hwpri[i1][i] <= avgpri[i])
				printf("fine");
			else
				printf("expensive");
			printf("\n");
		}
			
	}
}