Video summary

코드업 C 언어 기초 100제 1038번 풀이 : [기초-산술연산] 정수 2개 입력받아 합 출력하기1(설명) - 머털쌤

Main summary

Key takeaways

Educational

Main ideas / lessons conveyed

  • Task of the problem: Read two integers (inputs can be very large, including negative values) and print their sum.
  • Important concept: The usual int type may not be sufficient because the input includes values near the bounds of integer ranges.
  • Data type selection reasoning:
    • For int, the instructor notes you can only handle a limited range (mentions “last digit”/bounds informally).
    • For very large absolute values, the solution should use long long.
    • The unsigned type (unsigned int / unsigned) is not suitable because the inputs include negative numbers.
  • C implementation flow:
    • Include standard header(s)
    • Define main
    • Declare two long long int variables
    • Use scanf with the correct format specifiers to read them
    • Compute and output the sum using printf
  • Testing / verification:
    • The instructor describes compiling/running repeatedly to test whether:
      • values up to some boundary (including negatives) are handled correctly
      • larger maximum values also work
    • Then submit after successful tests.

Method / instruction steps (as presented)

  1. Choose the correct integer type

    • Use long long int for both numbers (not int, not unsigned).
  2. Write the program structure

    • #include <stdio.h>
    • int main(void) (or equivalent main signature)
    • Declare variables:
      • long long int num1;
      • long long int num2;
  3. Read input with scanf

    • Use format specifiers matching long long:
      • For long long int, use %lld
    • Example pattern:
      • scanf("%lld", &num1);
      • scanf("%lld", &num2);
  4. Compute and output

    • Print the sum:
      • printf("%lld", num1 + num2);
  5. Testing guidance

    • Compile/run and try values including:
      • boundary-like values (including negatives)
      • then increase toward the maximum allowed input range
    • If it works through the tested boundaries, proceed to submission.

Speakers / sources featured

  • Meoteol Sem (머털쌤) — the instructor narrating the solution
  • CodeUp (코드업) — the problem set context (“Code Up Basic … No. 38”, problem about summing two integers)

Original video