2.35M

1 prac

1.

2.

3.

4.

5.

6.

Displaying information on the screen
a = 234.193
print('% .1f '% a)
234.2
a = -234.123
print('% .2f '% a)
-234.12
a = 234.193
print('% 6.1f '% a)
234.2
b = -895.451
print('% 7.2f '% b)
-895.45

7.

Input a whole number and output it to console.
Input: A number.
Output: The same entered number.
Input:
7
Input:
8
Input:
-24
Output:
7
Output:
8
Output:
-24

8.

Input two numbers(with space between) and show their product.
Input: Two numbers.
Output: Their product.
Input:
34
Input:
12 -4
Input:
-23 -1
Output:
12
Output:
-48
Output:
23

9.

Input two numbers(with space between) and show their average. (Hint: integer
divided by integer gives an integer)
Input: Two numbers.
Output: Their average.
Input:
34
Input:
12 -4
Input:
-23 -1
Output:
3.5
Output:
4
Output:
-12

10.

Input two numbers (with space between) and show the remainder from the division of
the first number by the second one.
Input: Two numbers.
Output: The remainder.
Input:
52
Input:
74
Input:
84
Output:
1
Output:
3
Output:
0

11.

Input two numbers (k and c) and calculate the value of y for x = 0.1, 1, 5 where y = kx + c
Input: Two numbers.
Output: The value of y for every x (line by line).
Input:
34
Input:
12 -4
Input:
-23 -1
Output:
x = 0.1 : y = 4.3
x=1:y=7
x = 5 : y = 19
Output:
x = 0.1 : y = -2.8
x=1:y=8
x = 5 : y = 56
x = 0.1 : y = -3.3
x = 1 : y = -24
x = 5 : y = -116

12.

Input two real numbers (x and y) and calculate the following mathematical expression :
(x - 2y)x
----------2y
Input: Two numbers.
Output: Result of expression.
Input:
1 1.6
Input:
8 2.5
Output:
0.6875
Output:
-4.8

13.

Given three real numbers x, y, z. Output "YES", if x<y<z. Output NO, otherwise.
Example:
Input:
3.1 4.1 5.1
Output
YES
Example:
Input:
5.2 4.1 1.0
Output
NO

14.

Given a year number. Output the number of days of that year.
Example:
Input:
1900
Output
365
Example:
Input:
2012
Output
366

15.

HOME WORK
1. The ages of Mitya and Vasya are known. Determine which of them is older or
whether they are the same age.
2. The weight of an amateur boxer is known (in kg, in the form of realnumbers). It
is known that the weight is such that the boxer can be carriedto one of three
weight categories:
a) light weight – up to 60 kg;
b) b) first welterweight – up to 64 kg;
c) c) welterweight – up to 69 kg.
Determine in which category this box will perform.
3. Given two different integers a and b (a ≠ 0, b ≠ 0). Determine whether a is a
divisor of b, or b is a divisor of a,or neither number is a divisor of the other.
4. The serial number of the day of the week is given (1, 2, ..., 7). Output toscreen
its name (Monday, Tuesday, ..., Sunday).
5. The serial number of the month is given (1, 2, ..., 12). Displayits name (January,
February, ..., December).
6. The serial number of the month is given (1, 2, ..., 12). Displaynumber of days in
this month. Accept that the year is notleap year Use no more than three
branches in an if statement.
English     Русский Правила