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/4 | |
#include <iostream> | |
#include <cstdlib> | |
#include <ctime> | |
using namespace std; | |
// 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
Святова Мария Александровна 9/2-РПО-24/4 | |
//Task 1 | |
int main() | |
{ | |
int n; | |
cin >> n; | |
if (n > 0){ | |
cout << n + 1 << endl; |
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/4 | |
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
//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
111111 | |
num = [1,3,5,7,2,4,6,8] | |
max_sum = 10 | |
v = [] | |
sum = [] | |
x = 0 | |
for i in num: | |
if x + i <= max_sum: | |
v.append(i) | |
x += 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
111111 | |
num = [1,3,5,7,2,4,6,8] | |
max_sum = 10 | |
v = [] | |
sum = [] | |
x = 0 | |
for i in num: | |
if x + i <= max_sum: | |
v.append(i) | |
x += 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
11111111 | |
numbers = [] | |
for num in range(5): | |
num = [numbers.append(x) for x in input("Введите натуральное число: ")] | |
print(numbers) | |
22222 | |
number = [1,2,3,4,5] | |
sum = 0 |
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
numbers = [1,2,3,4,5,6,7,8] | |
for num in numbers: | |
print(num, end=" ") | |
print("\n", "-" * 10) | |
for num in range(len(numbers)): | |
print(numbers[num], end=" ") | |
numbers = [1,2,3,4,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
#6 | |
n = int(input("Введите число: ")) | |
o = 0 | |
for i in range(2, n + 1, 2): | |
o = o + i | |
print(f"{o} (", end="") | |
for i in range(2, n + 1, 2): | |
print(f"{i}+", end="") | |
print(")") |
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
#Квадрвт закрашенный | |
n = 5 | |
for i in range(n): | |
for j in range(n): | |
print("*", end=" ") | |
print() | |
#квадрат не закрашеннй | |
n = 5 | |
for i in range(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
треугольник закрашенный | |
n = 5 | |
for i in range(n): | |
for j in range(n): | |
if i == n - 1 or j == n - 1: | |
print("*", end=" ") | |
elif i > j: | |
print("*", end=" ") | |
print() | |
треугольник не закрашенный |
NewerOlder