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

cs101 ОП / Basics of programming ENG

  1. В начало
  2. Курсы
  3. Осенний семестр
  4. Фундаментальная информатика и ИТ
  5. cs101 ENG
  6. 1 topic. Basic constructions and loops
  7. Lesson #3. Boolean Expressions And Conditions

Lesson #3. Boolean Expressions And Conditions

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

Conditions and branches

Conditions consist of comparison operators that produce the value of Boolean (True or False)

For example the comparison operand a > 5:

If the value of left operand (in this case the value of variable a) is greater than the right operand (number 5) the condition becomes True or else we get a False:

...
a = 6
a > 5  ← True

a = 5
a > 5  ← False 

For example the comparison operand a >= 5:

If the value of left operand is greater than and equal to 5 the condition becomes True, or else we get a False.

...
a = 6
a >= 5  ← True

a = 5
a >= 5  ← True 

Logic operations

Conditions may consist of logic operations: not, or, and. If there are more than one condition, so each condition must be in round brackets.

For example for two conditions:

(year < 20) or (year > 18)

If one of the conditions or both conditions are True then the whole condition is True.

Or another example:

a = 5
(not a<4) and (7>5)  ← True

The statements write and print can also return True or False:

...
a = 5;
write (a >= 5); // returns True
...

Tasks (conditions)

In this section you cannot use a conditional statement, you can use only write or print statement.

1. {0.5 points}[task-01-bool.pas] Two integers are given. Check if the next statement is True: the first number is greater than the second (the program must return True if it is true and False otherwise).

2. {0.5 points}[task-02-bool.pas] Two integers are given. Check the truth of the statement: the first number is not equal to the second. (the program must return True if it is true and False otherwise).

3. {0.5 points}[task-03-bool.pas] Three integers are given: the values of variables A, B, C. Check the truth of the double inequálity A < B < C. Make sure that your program is correct with at least two input data sets, give the log of the program in the form of a comment.

4. {1 point}[task-04-bool.pas] Three-digit integer is given. Check the truth: the first digit (left digit) of the number is less than the second (middle) and third (right).

5. {1 point}[task-05-bool.pas] Two integers are given. Check the truth of the statement: at least one of these numbers is odd.

Note. Use the standard odd function:

The function odd returns True when its argument is odd integer:

print (odd(5)); // true 
print (odd(6)); // false 
example:
  -5,  8 >>> True
  12,  0 >>> False
  6, -1 >>> True
  11,  7 >>> True
◄ Lesson #2. Integers, div and mod operators
Lesson #4. Condition operator & branches. IF statement Part I (19/09) ►
Пропустить Навигация
Навигация
  • В начало

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

      • Мои курсы

      • Теги

    • Мои курсы

    • Курсы

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

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

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

          • Compiler Development

          • КПР

          • АЗПК

          • 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 ступень

        • Архив

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

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

        • Открытое тестирование - 2023 г.

        • Открытое тестирование - 2022 г.

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

        • Архив

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

        • ВМШ - 22

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

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

      • Олимпиады

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

      • Разное

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

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