104 lines
2.3 KiB
C
104 lines
2.3 KiB
C
|
#include <stdio.h>
|
|||
|
#include <windows.h>
|
|||
|
#define _USE_MATH_DEFINES
|
|||
|
#include <math.h>
|
|||
|
#define g 9.8f
|
|||
|
|
|||
|
void L2Z1(), L2Z2(), L2Z3(), L2Z4(), L2Z5(), L2Z6(), L2Z7();
|
|||
|
|
|||
|
int main2() {
|
|||
|
system("chcp 1251");
|
|||
|
|
|||
|
//L2Z1();
|
|||
|
//L2Z2();
|
|||
|
//L2Z3();
|
|||
|
//L2Z4();
|
|||
|
//L2Z5();
|
|||
|
//L2Z6();
|
|||
|
L2Z7();
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
void L2Z1() {
|
|||
|
float h = 12, t = sqrt(2 * h / g);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> %.2f <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n", t);
|
|||
|
}
|
|||
|
|
|||
|
void L2Z2() {
|
|||
|
float h, t;
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|||
|
scanf_s("%f", &h);
|
|||
|
t = sqrt(2 * h / g);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> %.2f <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", t);
|
|||
|
}
|
|||
|
|
|||
|
void L2Z3() {
|
|||
|
float S;
|
|||
|
int cost_per_meter;
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><> <20><>.<2E>: ");
|
|||
|
scanf_s("%f%d", &S, &cost_per_meter);
|
|||
|
float price = S * cost_per_meter;
|
|||
|
printf("%.2f", price);
|
|||
|
}
|
|||
|
|
|||
|
void L2Z4() {
|
|||
|
float S, percent = 0.5;
|
|||
|
int cost_per_meter, salary;
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|||
|
scanf_s("%f", &S);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <20><>.<2E>: ");
|
|||
|
scanf_s("%d", &cost_per_meter);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|||
|
scanf_s("%d", &salary);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %f <20><> <20><><EFBFBD><EFBFBD> %d <20><> <20><>.<2E> <20><><EFBFBD><EFBFBD><EFBFBD> %f\n", S, cost_per_meter, S * cost_per_meter);
|
|||
|
float t = (S * cost_per_meter) / (salary * percent);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %1.2f <20><><EFBFBD>", salary, t);
|
|||
|
}
|
|||
|
|
|||
|
void L2Z5() {
|
|||
|
float V, R, H;
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ");
|
|||
|
scanf_s("%f", &R);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|||
|
scanf_s("%f", &H);
|
|||
|
if (H > 2 * R) H = 2 * R;
|
|||
|
V = M_PI * pow(H, 2) * (R - H / 3);
|
|||
|
printf("V <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = %.2f", V);
|
|||
|
}
|
|||
|
|
|||
|
void L2Z6() {
|
|||
|
float V, a;
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|||
|
scanf_s("%f", &V);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|||
|
scanf_s("%f", &a);
|
|||
|
float S = pow(V, 2) * sinf(2 * a * M_PI / 180) / g;
|
|||
|
float H = pow(V * sinf(a * M_PI / 180), 2) / 2 / g;
|
|||
|
printf("L = %.2f\n", S);
|
|||
|
printf("H = %.2f\n\n", H);
|
|||
|
}
|
|||
|
|
|||
|
void L2Z7() {
|
|||
|
float A, r;
|
|||
|
int n;
|
|||
|
char currency[4];
|
|||
|
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|||
|
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>: ");
|
|||
|
scanf_s("%f", &A);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|||
|
scanf_s("%d", &n);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|||
|
scanf_s("%f", &r);
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|||
|
scanf_s("%s", currency, 4);
|
|||
|
|
|||
|
|
|||
|
float S = A + ((A + A / n) * r * n / 2 / 100);
|
|||
|
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %.2f %s\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %.2f %s\n\n", S, currency, S - A, currency);
|
|||
|
}
|