
Дано действительное число R вида nnn.ddd (три цифровых разряда в целой и дробной частях). Поменять
местами дробную и целую части числа и вывести полученное значение числа.

Ответы на вопрос

begin
var s:=ReadReal('r=').ToString;
var p:=Pos('.',s);
Writeln(Copy(s,p+1,3)+'.'+Copy(s,p-3,3))
end.
Тестовое решение:
r= 234.652
652.234



Swapping the Whole and Decimal Parts of a Number
To swap the whole and decimal parts of a number of the form nnn.ddd, you can use the following algorithm:
1. Extract the whole and decimal parts of the number. 2. Swap the positions of the whole and decimal parts. 3. Output the new number with the swapped parts.
Here's a simple algorithm to achieve this:
1. Extract the whole and decimal parts of the number. 2. Swap the positions of the whole and decimal parts. 3. Output the new number with the swapped parts.
For example, if the original number is 123.456, after swapping, it becomes 456.123.
Let's implement this algorithm in a programming language like Python:
```python # Input the number in the format nnn.ddd number = input("Enter the number in the format nnn.ddd: ")
# Extract the whole and decimal parts whole_part, decimal_part = number.split('.')
# Swap the positions of the whole and decimal parts new_number = decimal_part + '.' + whole_part
# Output the new number with the swapped parts print("The new number after swapping is:", new_number) ```
You can run this code and input a number in the format nnn.ddd to see the swapped result.
Note: This is a simple algorithm and code example to demonstrate the swapping of whole and decimal parts of a number. The actual implementation may vary based on the programming language and specific requirements.


Топ вопросов за вчера в категории Информатика
Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili