c2
This commit is contained in:
parent
0d75f30a49
commit
4744ebb565
69 changed files with 7 additions and 5 deletions
13
1sem/programming basics/z01/1.cpp
Normal file
13
1sem/programming basics/z01/1.cpp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// pb_z1_1.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <stdio.h>
|
||||
#include <algorithm>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int a, b;
|
||||
printf("a b >>>");
|
||||
scanf("%d %d", &a, &b);
|
||||
swap(a, b);
|
||||
printf("a=%d \nb=%d", a, b);
|
||||
}
|
||||
15
1sem/programming basics/z01/2.cpp
Normal file
15
1sem/programming basics/z01/2.cpp
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// pb_z1_2.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <stdio.h>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int num_people, num_seats, num_buses, num_free_seats;
|
||||
printf("People count seats count >>>");
|
||||
scanf("%d %d", &num_people, &num_seats);
|
||||
num_buses = num_people / num_seats;
|
||||
bool additional_seats = num_people % num_seats > 0;
|
||||
num_buses += additional_seats;
|
||||
num_free_seats = num_buses * num_seats - num_people;
|
||||
printf("Busses count: %d\nFree seats: %d\n", num_buses, num_free_seats);
|
||||
}
|
||||
14
1sem/programming basics/z01/3.cpp
Normal file
14
1sem/programming basics/z01/3.cpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// pb_z1_3.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <stdio.h>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
double d;
|
||||
printf("d >>>");
|
||||
scanf("%lf", &d);
|
||||
d = ((int)(abs(d) * 10)) % 10;
|
||||
printf("%d", (int)d);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue