diff --git a/SelfEducation/Task/T4/6ticket/func.c b/SelfEducation/Task/T4/6ticket/func.c new file mode 100644 index 0000000..8e81eb2 --- /dev/null +++ b/SelfEducation/Task/T4/6ticket/func.c @@ -0,0 +1,16 @@ +#include +#include +#define N 6 + +void print_revers(int x) +{ + int res = 0; + for (int i = N - 1; i > -1; i--) + { + res += (x / (int)pow(10, i)) * (int)pow(10, (N - 1 - i)); + x = x % (int)pow(10, i); + printf("%d | %d\n", x, res); + } + + printf("%d\n", res); +} \ No newline at end of file diff --git a/SelfEducation/Task/T4/6ticket/main.c b/SelfEducation/Task/T4/6ticket/main.c new file mode 100644 index 0000000..63ea1cb --- /dev/null +++ b/SelfEducation/Task/T4/6ticket/main.c @@ -0,0 +1,14 @@ +#include + +void print_revers(int x); + +int main() +{ + int x; + + scanf("%d", &x); + + print_revers(x); + + return 0; +} \ No newline at end of file diff --git a/SelfEducation/Task/T4/6ticket/out/6t_app b/SelfEducation/Task/T4/6ticket/out/6t_app new file mode 100755 index 0000000..494aea4 Binary files /dev/null and b/SelfEducation/Task/T4/6ticket/out/6t_app differ diff --git a/SelfEducation/Task/T4/dist/func.c b/SelfEducation/Task/T4/dist/func.c new file mode 100644 index 0000000..23c191c --- /dev/null +++ b/SelfEducation/Task/T4/dist/func.c @@ -0,0 +1,29 @@ +#include +#include +#include + +float dist(int x1, int y1, int x2, int y2) +{ + float res, a, b; + + a = abs(x1 - x2); + b = abs(y1 - y2); + res = sqrt(a * a + b * b); + + return res; +} + +float area_geron(int x1, int y1, int x2, int y2, int x3, int y3) +{ + float res, p, a, b, c; + + a = dist(x1, y1, x2, y2); + b = dist(x2, y2, x3, y3); + c = dist(x1, y1, x3, y3); + + p = (a + b + c) / 2; + + res = sqrt(p * (p - a) * (p - b) * (p - c)); + + return res; +} \ No newline at end of file diff --git a/SelfEducation/Task/T4/dist/main.c b/SelfEducation/Task/T4/dist/main.c new file mode 100644 index 0000000..8e9b5c5 --- /dev/null +++ b/SelfEducation/Task/T4/dist/main.c @@ -0,0 +1,21 @@ +#include +#include + +float dist(int x1, int y1, int x2, int y2); +float area_geron(int x1, int y1, int x2, int y2, int x3, int y3); + +int main() +{ + int x1, y1, x2, y2, x3, y3; // координаты точек + float len, area; // длина + + scanf("%d%d", &x1, &y1); // прочитали числа + scanf("%d%d", &x2, &y2); + scanf("%d%d", &x3, &y3); + + area = area_geron(x1, y1, x2, y2, x3, y3); + + printf("%.3f\n", area); + + return 0; +} \ No newline at end of file diff --git a/SelfEducation/Task/T4/dist/out/dist_app b/SelfEducation/Task/T4/dist/out/dist_app new file mode 100755 index 0000000..07ad1f5 Binary files /dev/null and b/SelfEducation/Task/T4/dist/out/dist_app differ diff --git a/SelfEducation/Task/T4/fahr/func.c b/SelfEducation/Task/T4/fahr/func.c index 7f65bb9..c56873e 100644 --- a/SelfEducation/Task/T4/fahr/func.c +++ b/SelfEducation/Task/T4/fahr/func.c @@ -4,7 +4,16 @@ float fahr(int cel) { float res; - res = cel * 9 / 5 + 32; + res = (float)cel * 9 / 5 + 32; + + return res; +} + +float celsius(int fahr) +{ + float res; + + res = ((float)fahr - 32) * 5 / 9; return res; } \ No newline at end of file diff --git a/SelfEducation/Task/T4/fahr/main.c b/SelfEducation/Task/T4/fahr/main.c index f3152a5..eeddea0 100644 --- a/SelfEducation/Task/T4/fahr/main.c +++ b/SelfEducation/Task/T4/fahr/main.c @@ -1,16 +1,18 @@ #include -#include "func.c" float fahr(int cel); +float celsius(int fahr); int main() { - int cel; // градусы Цельсия - float f; // градусы Фаренгейта + int cel; // градусы Цельсия + float f, ans; // градусы Фаренгейта scanf("%d", &cel); f = fahr(cel); printf("%.2f\n", f); // .2f - печатать с точностью до 2 знаков после . + ans = celsius((int)f); + printf("%.2f\n", ans); return 0; } \ No newline at end of file diff --git a/SelfEducation/Task/T4/fahr/out/fahr_app b/SelfEducation/Task/T4/fahr/out/fahr_app new file mode 100755 index 0000000..3f3ce10 Binary files /dev/null and b/SelfEducation/Task/T4/fahr/out/fahr_app differ