PZ
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user