작성일 :

문제 링크

24078번 - 余り (Remainder)

설명

양의 정수를 21로 나눈 나머지를 구하는 문제입니다.


접근법

정수를 입력받아 21로 나눈 나머지를 출력합니다.



Code

C#

1
2
3
4
5
6
7
8
using System;

class Program {
  static void Main() {
    var x = int.Parse(Console.ReadLine()!);
    Console.WriteLine(x % 21);
  }
}

C++

1
2
3
4
5
6
7
8
9
10
11
12
#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int x; cin >> x;
  cout << (x % 21) << "\n";

  return 0;
}