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; | |
#define task_1 | |
#ifdef task_1 | |
int main() { | |
double x, y; | |
cout << "Введите x - "; |
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
// Амплеев Иван 9/2-РПО-24/2 | |
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
#define task_1 | |
#ifdef task_1 | |
int main() { |
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 | |
numbers = [ 1, 3, 5, 7, 2, 4, 6, 8 ] | |
group = [] | |
current_group = [] | |
current_sum = 0 | |
max_sum = 10 | |
for i in numbers: | |
if current_sum + i <= max_sum: | |
current_group.append(i) |
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 | |
# # i = 0 | |
# # num = [] | |
# # while i < 5: | |
# # i+=1 | |
# # numbers = int(input("Введите ваше число")) | |
# # num = num + numbers | |
# # print(f"{num}") | |
# # | |
# # # Задание №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 | |
# i = 0 | |
# num = [] | |
# while i < 5: | |
# i+=1 | |
# numbers = int(input("Введите ваше число")) | |
# num = num + numbers | |
# print(f"{num}") | |
# | |
# # Задание №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 - Пустой квадрат | |
for row in range(10): | |
for col in range(10): | |
if row == 0 or col == 0 or row == 10 - 1 or col == 10 - 1: | |
print('*', end=" ") | |
else: | |
print(end=' ') | |
print('') | |
# 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: | |
n=0 | |
while True: | |
b=int(input("Введите число:")) | |
if b<0: | |
break | |
else: | |
n+=b | |
print(n) |
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: | |
number1 = int(input("Введите начало диапазона: ")) | |
number2 = int(input("Введите конец диапазона: ")) | |
while number2 - number1 >= 1: | |
number2 = number2 - 1 | |
if number2 % 7 == 0: | |
print(number2) | |
Задание №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: | |
number = int(input("Введите любое число: ")) | |
number2 = 1 | |
while True: | |
result = number * number2 | |
if result > 50: | |
break | |
print(f"{number} * {number2} = {result}") | |
result += 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
Цикл с условиема while - это цикл, который работает до тех пор, пока условие ИСТИНА. | |
Итерация - это один шаг цикла. | |
Синтаксис: | |
while условие: | |
код_для_повторения_изменения_переменной | |
break - остановка цикла. | |
continue - пропуск итерации. |
NewerOlder