This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
int main() { | |
double a,b,s,p,c,v,s2,res1,res3,res2,res4,p1,p2,m1,m2,c1; | |
cin >> a >> b >> c; | |
//1 | |
s = 2 * (a + b); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1 ромб сверху пустой | |
size =10 | |
for row in range(size-1): | |
for col in range(size-1): | |
if col + row == size - 6: | |
print("*", end=" ") | |
elif col == row + 4: | |
print("*", end=" ") | |
elif col == row - 4: # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1 квадраты | |
number=int(input("Введите число: ")) | |
for row in range(number): | |
for col in range(number): | |
print("+", end=' ') | |
print() | |
print(f"\n") | |
for row in range(number): | |
for col in range(number): | |
if row == 0 or col == 0 or row == number - 1 or col == number - 1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Зад 6 | |
number=int(input('Введите десятизначное число: ')) | |
max=9 | |
min=0 | |
while number > 0: | |
T=number%10 | |
if T < max: | |
max=T | |
if T > min: | |
min=T |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Зад 1 | |
number=int(input("Введите число: ")) | |
summ=0 | |
begin=1 | |
summ1=0 | |
for begin in range(number): | |
summ+=1 | |
summ1+=summ | |
print(summ1) | |
# Зад 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Цикл for | |
Интератор-об | |
range() | |
range(start,stop,step) | |
for i in range(5): | |
print(i) | |
import random=импортирует рандом в | |
random - генерирует рандомные числа | |
print(random.random()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Зад 1 | |
Begin=int(input('Введите 1 число: ')) | |
end=int(input('Введите 2 число: ')) | |
while Begin < end: | |
if Begin %7 == 0: | |
print(Begin) | |
elif Begin == end: | |
break | |
Begin += 1 | |
# Зад 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# зад 1 | |
p=int(input('Введите число: ')) | |
o=p%2 | |
if o == 0: | |
print('число чётное') | |
t=p%5 | |
if t == 0: | |
print('Число кратно 5') | |
else: | |
print('число не кратно 5') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Зад 1 | |
ts=int(input('Введите время в секундах: ')) | |
t=86400-ts | |
s='S' | |
m='M' | |
h='H' | |
c=input(f'Выбирете что хотите увидеть:' | |
' S-время в секундах' | |
' M-время в минутах' | |
' H-время в часах ' ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Часть 1 | |
# зад 1 | |
number = int(input('Введите число: ')) | |
if number%2 == 0: | |
print('Чётное число') | |
else: | |
print('Не чётное число') | |
# зад 2 | |
number7=int(input('Введите число: ')) |
NewerOlder