This commit is contained in:
Andrew 2019-11-18 10:01:42 +07:00
commit 2802401eee
79 changed files with 2650 additions and 0 deletions

View file

@ -0,0 +1,18 @@
// pb_2_0.cpp
// Горбацевич Андрей
#include <stdio.h>
using namespace std;
int main() {
long a, b;
printf("Input `a` and `b` >>>");
scanf("%ld %ld", &a, &b);
long sum = a + b;
long diff = a - b;
long multiplication = a * b;
printf("Sum(%%ld): %ld \nMultiplication(%%10ld): %10ld \nDifference(%%-10ld): %-10ld\n",
sum, multiplication, diff);
double mean = (float)(a + b) / 2.f;
printf("Mean:\n%%f: %f\n%%15.4f: %15.4f\n%%-15.4f: %-15.4f\n%%0.15f: %0.15f\n%%30.15f: %30.15f",
mean, mean, mean, mean, mean);
}

View file

@ -0,0 +1,16 @@
// pb_2_1.cpp
// Горбацевич Андрей
#include <stdio.h>
#include <cmath>
using namespace std;
int main() {
double x1, y1, x2, y2, x3, y3;
printf("x1 y1 x2 y2 x3 y3 >>>");
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
double S = ((x1 - x3)*(y2 - y3) - (x2 - x3)*(y2 - y3)) / 2.f;
// 1 | x1-x3 y1-y3 |
// S = --- | |
// 2 | x2-y3 y2-y3 |
printf("S=%f", abs(S));
}

View file

@ -0,0 +1,14 @@
// pb_2_2.cpp
// Горбацевич Андрей
#include <stdio.h>
#include <cmath>
using namespace std;
int main() {
int deg;
printf("deg >>>");
scanf("%d", &deg);
int elapsedHours = deg / 30;
int elapsedMinutes = elapsedHours*60 + deg / 6;
printf("Elapsed hours: %d \nElapsed minutes: %d", elapsedHours, elapsedMinutes);
}