forked from Maria02179/mp1-2020-382003-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray2.c
36 lines (35 loc) · 765 Bytes
/
array2.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
#include "stdio.h"
#include "locale.h"
#include "math.h"
#include <locale.h>
void main(){
setlocale(LC_ALL, "Rus");
int i;
int size;
int r = 0;
printf("Ââåäèòå êîëè÷åñòâî òî÷åê\n");
scanf_s("%d", &size);
int* A = (int*)malloc(sizeof(int) * (size));
printf("Ââåäèòå êîîðäèíàòû\n");
for (i = 0; i < 2*size; i++)
{
scanf_s("%d", &A[i]);
}
int min = sqrt(A[0]*A[0] + A[1]*A[1]);
int max = sqrt(A[0]*A[0] + A[1]*A[1]);
setlocale(LC_ALL, "Rus");
for (i = 2; i < 4; i = i + 2)
{
r = sqrt(A[i]* A[i] + A[i + 1] * A[i + 1]);
if (r > max) {
max = r;
}
else {
if (r < min) {
min = r;
}
}
}
printf("Ìàêñèìàëüíûé ðàäèóñ=%d\n", max);
printf("Ìèíèìàëüíûé ðàäèóñ=%d\n", min);
}