Перейти к основному содержанию
EDU-MMCS
Вы используете гостевой доступ (Вход)

Basic of programming

  1. В начало
  2. Курсы
  3. Воскресная математическая школа
  4. Лаборатория математического онлайн-образования мех...
  5. Basics of programming
  6. Topic 1. Basic constructions
  7. 5. Labs and Tasks

5. Labs and Tasks

Требуемые условия завершения
Открыто с: суббота, 9 августа 2025, 00:00

{0.2} Task 1:

To do: A distance L in centimeters is entered. Use the operation of integer division to convert it to meters of (1 meter = 100 centimeters). Use comments to make the program clear to user. Give the log of your program in the form of a comment after the program code.

Expected output:

Please enter the distance in centimeters
>>> 245
The distance in meters is  2 
[Program name: L2task01.pas]

{0.2} Task 2:

To do: A mass in kilograms is entered. Use integer division to convert it to tons (1 ton = 1000 kilos). Use comments to make the program understandable to user. Give the log of your program as a comment after the program code.

Expected output:

Please enter the mass in kilos
>>> 4527
The mass in tons is 4 
[Program name: L2task02.pas]

{0.3} Task 3:

To do: The person's age in months is entered. Convert it to a person's age in years (e.g: 65 months is 5 full years, 24 months is 2 years). Verify the correctness of your program, give the log as a comment.

Expected output:

Please enter the age in months
>>> 37
The age in years is 3 
[Program name: L2task03.pas]

{0.3} Task 4:

To do: A two-digit integer is entered. Output its first and second digits separated by commas (i.e. left and right digits).

Note: Run the program and enter a non-two-digit number. What has happened? Is the result correct? Later we will learn how to perform validation of the input data.

Expected output:

Please enter a two digit number
>>> 37
The first and second are  7,  3
+++
Please enter a two digit number:
>>> -35
The first and second are 5, 3
+++
Please enter a two digit number:
>>> 90
The first and second are 0, 9 
[Program name: L2task04.pas]

{0.3} Task 5:

To do: A two-digit integer is entered. Output the addition and multiplication of its digits. Check the correctness of your program.

Note: Each digit of the number will be needed twice: in the calculation of the sum — the first time and in the calculation of the multiplication — the second time. It is recommended to use auxiliary variables for storing the values of the digits.

Expected output:

please enter a two digit number
>>> 73
you entered 73. The result is 10, 21 
[Program name: L2task05.pas]

{0.3} Task 6:

To do: A three-digit integer is entered. Output all of its digits (the order does not matter). Check the correctness of your program, give the log in the form of a comment.

Expected output:

Please enter a three-digit number
>>> -105
The three digits are : 1, 0, 5 
[Program name: L2task06.pas]

{0.3} Task 7:

To do: A three-digit integer is entered. Output the addition of its digits. Make sure that your program works correctly with negative numbers.

Expected output:

Please enter a three-digit number
>>> -745
You entered: 745. The addition of its three digits is equal to 16 
[Program name: L2task07.pas]

{0.4} Task 8:

To do: Two digits (in the range from 0 to 9) are entered. Use the standard form of a number to make a number, the digits of which are the specified digits.

Expected output:

Please enter two digits
>>> 3
>>> 5
The new number is 35 
Check the following:

3, 5 => 35
7, 0 => 70
0, 4 => 4
[Program name: L2task08.pas]

{0.4} Task 9:

To do: A two-digit integer is entered. Swap the values of its left and right digits and output the resulting number. Check the correctness of your program, give the log in the form of a comment.

Expected output:

please enter a two digit number
>>> -57
you entered -57. The result is -75
Check the following:

35 =>  53
-10 => -1
[Program name: L2task09.pas]

{0.4} Task 10:

To do: A three-digit integer is entered. Swap the values of its left and middle digits. Check the correctness of your program, give the log in the form of a comment.

Expected output:

please enter a three digit integer
>>> 846
After swapping the left and middle digits, the result is 486 
[Program name: L2task10.pas]

{0.4} Task 11:

To do: A three-digit integer is entered. Make a cyclic shift of digits to the left.

Expected output:

please enter a three digit integer
>>> -734
After making a cyclic shift of digits to the left, the result is -347 
Check the following:

 123 =>  231
-602 => -26
[Program name: L2task11.pas]

{0.4} Task 12:

To do: A three-digit integer is known. Make a cyclic shift of digits to the right.

Expected output:

please enter a three digit integer
>>> -184
After a cyclic shift of digits to the right, the result is -418 
[Program name: L2task12.pas]

Tasks for self-solving

Note: tasks should be saved in a file with the name of the task, and be sure to insert a comment with the statement of the task in the code.

INTEGER

Integer7.

A two-digit integer is given. Find the sum and the product of its digits.

Expected output:

<< 47
results:
sum = 11  product = 28

Integer9.

A three-digit integer is given. Using one operator of integer division find first digit of the given integer (a hundreds digit).

Expected output:

<< 188
results:
1

Integer10.

A three-digit integer is given. Output its last digit (a ones digit) and then its middle digit (a tens digit).

Expected output:

<< 916
results:
ones 6, tens 1

Integer11.

A three-digit integer is given. Find the sum and the product of its digits.

Expected output:

<< 363
results:
sum 12, product 54

Integer12.

A three-digit integer is given. Output an integer obtained from the given one by reading it from right to left.

Expected output:

<< 263
results:
362

Integer13.

A three-digit integer is given. Output an integer obtained from the given one by moving its left digit to the right side.

Expected output:

<< 124
results:
241
◄ 4. Working with digits of a number (div and mod)
Video explanation - 2 ►
Пропустить Навигация
Навигация
  • В начало

    • Страницы сайта

      • Мои курсы

      • Теги

    • Мои курсы

    • Курсы

      • Воскресная математическая школа

        • Открытое тестирование РНОМЦ и мехмата ЮФУ - 2025

        • Олимпиадная математическая школа

        • Повышение квалификации

        • Доступная математика

        • Лаборатория математического онлайн-образования мех...

          • Basics of programming

            • Общее

            • Topic 1. Basic constructions

              • СтраницаVideo explanation - 1

              • Страница1. Introduction

              • Страница2. Variables, Calculations, Input and Output

              • Задание3. Labs and Tasks

              • Страница4. Working with digits of a number (div and mod)

              • Задание5. Labs and Tasks

            • Topic 2. Conditions

            • Topic 3. Loops

            • Topic 4. Procedures and Functions

            • Topic 5. Arrays

          • Тест - модуль

          • Функции

          • Алгоритмы - I

          • Основы ЭО

          • Higher Math Intro

          • Основы программирования

        • Осенняя универсиада

        • Научно-практическая конференция

        • ВМШ

          • ВМШ - 24

        • Летняя олимпиадная математическая школа РНОМЦ и ме...

        • ОМШ мехмата ЮФУ

        • ЗФТШ - 2021-2022

      • Осенний семестр

        • Прикладная математика и информатика

        • Фундаментальная информатика и ИТ

        • Математика, механика

        • Педагогическое образование

        • Магистратура

          • Разработка мобильных приложений и компьютерных игр

        • Аспирантура

        • Вечернее отделение

        • Другое

      • Весенний семестр

        • Прикладная математика и информатика

        • Фундаментальная информатика и ИТ

        • Математика, механика

        • Педагогическое образование

        • Магистратура

          • Разработка мобильных приложений и компьютерных игр

        • Аспирантура

        • Вечернее отделение

        • Другое

      • Воскресная компьютерная школа

        • Пользователь компьютера плюс

        • Пользователь прикладных программ

        • Программирование I ступень

        • Программирование II ступень

        • Программирование III ступень

        • Архив

      • Государственная итоговая аттестация

      • Дополнительное образование

      • Олимпиады

      • Видеолекции

      • Разное

      • Архив курсов

      • Заочная школа мехмата ЮФУ

Служба поддержки сайта
Вы используете гостевой доступ (Вход)
Basics of programming
Сводка хранения данных
Скачать мобильное приложение Яндекс.Метрика