aboutsummaryrefslogtreecommitdiff
path: root/Semestr 4/ask/lista 2/pom.c
blob: 87d542d33f58319fc762ed59f689bf862334e439 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdint.h>
#include <stdio.h>
#include <limits.h>

char* utb(uint32_t x) {
  static char rep[36];
  int cnt = 34;
  for (int i = 0; i < 32; i += 1) {
    if (i > 0 && i % 8 == 0) {
      rep[cnt] = ' ';
      cnt -= 1;
    }
    rep[cnt] = (x & 1) + '0';
    cnt -= 1;
    x >>= 1;
  }
  rep[35] = '\0';
  return rep;
}

void pb(uint32_t x) {
  printf("%s    : %d\n", utb(x), x);
}

// int main() {
//     /* Zadanie 1 */

//     int32_t x;
//     x = (1<<31);
//     printf("%d, %d, %d %d\n", x, (x > 0), x-1, (x - 1 < 0));
// }

int main() {
    /* Zadanie 1 */
    int32_t x;
    scanf("%d", &x);
    printf("%d %d\n", x*x, INT_MIN);
}