CS208 Introduction to Computer Systems Monday, 12 January 2026 + Quiz + Questions? + Today - Negative integers - Last week's quiz returned - Start on character encodings + Coming up - Assignment due Thursday - Quiz Friday (two's complement integers) - Assignment due Sunday + Negative integers - Signed magnitude - Two's complement - Why two's complement? - Negating in two's complement Question: assuming the following is a 32-bit two's complement representation of an integer, what is its decimal value? 0xFFFFFFE5 + Quizzes back + Character encoding - What? - ASCII - ISO-8859-1 ==== def factorial(n): total = 1 for k in range(2, n+1): total *= k return total for k in range(1, 21): print(f'{k}! = {factorial(k)}') --- #include int factorial(int n) { int total = 1; for (int k=2; k <= n; k++) { total *= k; } return total; } int main() { for (int k=1; k <= 20; k++) { printf("%d! = %d\n", k, factorial(k)); } return 0; } --- #include int main() { int k = 1; while (k > 0) { k++; } printf("%d\n", k); printf("0x%x\n", k); return 0; } --- #include int main() { int x = 0xFFFFFFE5; printf("%d\n", x); x = (~x) + 1; printf("%d\n", x); return 0; }