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

cs101 ОП / Basics of programming ENG

  1. В начало
  2. Курсы
  3. Осенний семестр
  4. Фундаментальная информатика и ИТ
  5. cs101 ENG
  6. 1 topic. Basic constructions and loops
  7. Lesson #10. Minimum or Maximum value of N numbers

Lesson #10. Minimum or Maximum value of N numbers

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

Lections

Task: n numbers are given ( n >= 0 is entered from the keyboard). Find minimum value of these numbers.

****************************************************************

Solution1. Let's assign the first entered number to  min variable. Then in a loop check if the next entered number is less than min. If it is, so reassign this value to min:


What is not good: The first value is handled separately.

******************************************************************************

Solution2. Let's assign the maximum value of real type (real.MaxValue) to min variable. Then in a loop check if the first entered number is less than min. If it is, so reassign this value to min.

The idea is that after the first iteration min will be reassigned in any case because x < real.MaxValue:


**************************************************************************************************

✎

1. {0.3}[task-1-min.pas]. 5 numbers are entered. Output the maximum and minimum of the entered numbers.

E.g.:

5 3 8 1 2  => maximum is 8, minimum is 1

2. {0.5}[task-2-min.pas]. An integer N is given and a set of N rectangles defined by their sides (pairs of numbers a and b). Find the areas of all the rectangles and minimum area of them.

E.g.:

How many rectangles?
3
Please, enter the sides of the rectangles:
2 3
1 5
4 2
The minimum area of all rectangles is 5.

3. {0.5}[task-3-min.pas]. An integer N is given and a set of N rectangles defined by their sides (pairs of numbers a and b). Find the perimeters of all the rectangles and maximum perimeter of them.

E.g.:

How many rectangles?
3
Please, enter the sides of the rectangles:
2 3
1 5
4 2
The maximum perimeter of all rectangles is 12.

4. {0.3}[task-4-min.pas]. Find the minimum of 5 entered numbers and print its serial number (order).

E.g.:

5 3 8 1 2  => minimum is 1, its serial number is 4

5. {0.5}[task-5-min.pas]. Find the minimum and maximum of 10 entered numbers and print the sum of their serial numbers.

E.g.:

2  15  3  8  1  2  9  1  7  11   => max is 15, min is 1, 15 + 1 = 16 

6. {0.5}[task-6-min.pas]. An integer N is given and a set of N numbers (entered from the keyboard). Find a serial number of the first minimum among the numbers and serial number of the last maximum among the numbers.

E.g.:

2  15  3  8  1  2  9  1  15  11   => serial numb of min is 5, serial numb of max is 9

◄ Lesson #9. Sum, Accumulators, Product and Counter. Nested loops
Lesson #11. While & Repeat Loops ►
Пропустить Навигация
Навигация
  • В начало

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

      • Мои курсы

      • Теги

    • Мои курсы

    • Курсы

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

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

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

          • Compiler Development

          • CMVSM

          • АЗПК

          • Frontend

          • ТеорЯП

          • Ruby Eng

          • EngCA&OS

          • CS201e

          • Компиляторы - лекции

          • CS202

          • CS211 C++ ENG

          • cs101 ENG

            • Общее

            • 1 topic. Basic constructions and loops

              • ЗаданиеLesson #1. Introduction to PascalABC.NET

              • ЗаданиеLesson #2. Integers, div and mod operators

              • ЗаданиеLesson #3. Boolean Expressions And Conditions

              • ЗаданиеLesson #4. Condition operator & branches. IF s...

              • ЗаданиеLesson #5. IF statement Part II. Max and Min

              • ЗаданиеHometask (until 6/10)

              • ЗаданиеFormatted output using WritelnFormat

              • ЗаданиеLesson #6. Chained IF statements and Case statemen...

              • ЗаданиеLesson #7. Loops

              • ЗаданиеLesson #8. For Loop

              • ЗаданиеLesson #9. Sum, Accumulators, Product and Counter....

              • ЗаданиеLesson #10. Minimum or Maximum value of N numbers

              • ЗаданиеLesson #11. While & Repeat Loops

              • ЗаданиеLesson #12. While & Repeat Loops: digits of a ...

              • ЗаданиеLesson #13. Procedures

              • ЗаданиеLesson #14. Functions

              • ЗаданиеTest Loops (control test)

            • Тема 2

            • Тема 3

            • Тема 4

            • Тема 5

            • Тема 6

            • Тема 7

            • Тема 8

            • Тема 9

            • Тема 10

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

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

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

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

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

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

        • Другое

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

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

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

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

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

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

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

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

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

        • Другое

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

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

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

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

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

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

        • Архив

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

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

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

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

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

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

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

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

        • ВМШ

          • ВМШ - 24

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

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

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

      • Олимпиады

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

      • Разное

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

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

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