S
S
silin_n2015-11-26 16:31:06
Informatics
silin_n, 2015-11-26 16:31:06

How to remove a number in pascal?

Given a five digit number. What is the number you get if you remove the penultimate digit?
For example 15978 -> 1598.
Many thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Belyaev, 2015-11-26
@silin_n

r := (n div 100) * 10 + (n mod 10)

V
Vladimir Martyanov, 2015-11-26
@vilgeforce

Convert the number to a string, collect a new string from the elements of the old one. Convert string back to number. For example it is possible so. Or find the first three digits (through division) and the last (through the remainder of the division). Then through addition and multiplication you get the result.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question