Number of fiscal identification

Write a program that reads a sequence of numbers of identity card (DNIs) and prints them adding their letter corresponding to the number of fiscal identification (NIF).

To compute the NIF letter, you must compute the remainder of divide the number of DNI by 23 and use the following correspondence:

0 T
1 R
2 W
3 A
4 G
5 M
6 Y
7 F
8 P
9 D
10 X
11 B
12 N
13 J
14 Z
15 S
16 Q
17 V
18 H
19 L
20 C
21 K
22 E

Input

Input is a sequence of DNI numbers (positive integer numbers with eight or less digits).

Output

For each DNI number of the input, print it in a line with exactly eight digits and adding its letter corresponding to the NIF separated by a dash.

Observation

Use a function to return the letter corresponding to every number between 0 and 22. Use a function @number_of_digits()@ that computes the number of digits of a number and use it to print the zeros on the left.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T21:46:13.925Z

© Jutge.org, 2006–2026.
https://jutge.org