Вопрос задан 01.08.2018 в 20:01. Предмет Информатика. Спрашивает Зайнутдинова Александра.

Составьте программу,которая проверяет,является ли человек заданного возраста школьником,если

возраст школьника- от 6 до 17лет,и выводит на экран
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Хайруллина Карина.
Program pr1;
var x : integer;
begin
writeln ('Введите возраст');
readln (x);
if (x>=6) and (x<=17) then
writeln ('Это школьник') else
writeln ('Это не школьник');
readln;
end.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Program to Check if a Person is a School Student

Here is a program in Python that checks if a person is of school age (between 6 and 17 years old) and displays the result on the screen:

```python def check_school_age(age): if age >= 6 and age <= 17: print("The person is a school student.") else: print("The person is not a school student.")

# Example usage age = int(input("Enter the age: ")) check_school_age(age) ```

This program defines a function called `check_school_age` that takes an `age` parameter. It checks if the age is between 6 and 17 (inclusive) using an `if` statement. If the condition is true, it prints "The person is a school student." Otherwise, it prints "The person is not a school student."

You can run this program and enter the age to check if the person is a school student.

Please note that this program assumes the age input is a valid integer. If you need to handle invalid inputs, additional code can be added to validate the input.

Example usage: ``` Enter the age: 10 The person is a school student. ```

``` Enter the age: 20 The person is not a school student. ```

I hope this helps! Let me know if you have any further questions.

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос