This commit is contained in:
328p
2026-09-29 18:00:19 +03:00
commit ab145ab1d7
6 changed files with 61 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
Задание 1:
int divide(int a, int b) {
return a / b;
}
Задание 2:
#include <stdint.h>
uint16_t swap_bytes_16(uint16_t val) {
return ((val & 0x00FF) << 8) | ((val & 0xFF00) >> 8);
}
Задание 3:
см. скриншот
Задание 4:
int multiply_by_3(int x) { return x * 3; }
int multiply_by_5(int x) { return x * 5; }
int multiply_by_9(int x) { return x * 9; }
Задание 5:
int factorial(int n) {
int result = 1;
for (int i = 1; i <= n; i++) {
result = result * i;
}
return result;
}
https://godbolt.org/z/Yn6exTrEE
https://godbolt.org/z/GePnx7oz3
https://godbolt.org/z/GMWfYe4h5
https://godbolt.org/z/x65WvvEcs