Вот простой пример написанный на С++
Если нужно объяснить программу то пиши: Telegram @danileremeev
#include <iostream>
using namespace std;
struct st{
int x1, x2, x3, amount, composition, sum_of_squares;
int number, thousand, hundreds, dozens, units;
int a, b, amount_ab, difference_ab, composition_ab;
}; st St;
int main() {
setlocale(0, "");
cout << "1)\n";
cout << "x1: "; cin >> St.x1;
cout << "x2: "; cin >> St.x2;
cout << "x2: "; cin >> St.x3;
St.amount = St.x1 + St.x2 + St.x3;
St.composition = St.x1 * St.x2 * St.x3;
St.sum_of_squares = (St.x1 * St.x1) + (St.x2 * St.x2) + (St.x3 * St.x3);
cout << "суммa: " << St.amount << "\nпроизведение: " << St.composition << "\nсумму квадратов: "<<St.sum_of_squares << endl;
cout << "\n2)\n";
for (;;) {
cout << "введите четырехразрядное число: ";
cin >> St.number;
if (St.number >= 1000 && St.number <= 9999) {
St.thousand = St.number / 1000;
St.hundreds = St.number / 100;
St.dozens = St.number / 10;
St.units = St.number / 1;
cout << "Тысяч - " << St.thousand << ", сотен - " << St.hundreds << ", десятков - " << St.dozens << ", единиц - " << St.units;
break;
}
cout << "\n\n3)\n";
cout << "Введите два натуральных числа <=10\n";
cin >> St.a >> St.b;
if (St.a >= 0 && St.a <= 10 && St.b >= 0 && St.b <= 10) {
St.amount_ab = St.a + St.b;
St.difference_ab = St.a - St.b;
St.composition_ab = St.a * St.b;
cout << "суммa: " << St.amount_ab << "\nразность: " << St.difference_ab <<"\nпроизведение: " << St.composition_ab << endl;
system("pause > nul");
1:
for i in range (1000,10000):
i = str(i)
if int(i[3]) % 5 == 0:
print()
print(int(i), end=' ')
2:
n = int(input())
summ = 1
for i in range(1, n + 1):
summ *= abs(i)
print(summ)
3:
i = 1
a = 0
while(i <= 9999):
a += 1 / i
i += 2
i = 2
b = 0
while(i <= 10000):
b += 1 / i
print(a - b)
4:
x, m, n= map(int, input().split())
for i in range(m,n+1):
if i % x == 0:
summ *= i
5:
lst = [int(i) for i in input().split()]
count = 0
summ = 0
for i in lst:
if len(str(i)) == 1:
count += 1
summ += i
print(summ / count)
Вот простой пример написанный на С++
Если нужно объяснить программу то пиши: Telegram @danileremeev
#include <iostream>
using namespace std;
struct st{
int x1, x2, x3, amount, composition, sum_of_squares;
int number, thousand, hundreds, dozens, units;
int a, b, amount_ab, difference_ab, composition_ab;
}; st St;
int main() {
setlocale(0, "");
cout << "1)\n";
cout << "x1: "; cin >> St.x1;
cout << "x2: "; cin >> St.x2;
cout << "x2: "; cin >> St.x3;
St.amount = St.x1 + St.x2 + St.x3;
St.composition = St.x1 * St.x2 * St.x3;
St.sum_of_squares = (St.x1 * St.x1) + (St.x2 * St.x2) + (St.x3 * St.x3);
cout << "суммa: " << St.amount << "\nпроизведение: " << St.composition << "\nсумму квадратов: "<<St.sum_of_squares << endl;
cout << "\n2)\n";
for (;;) {
cout << "введите четырехразрядное число: ";
cin >> St.number;
if (St.number >= 1000 && St.number <= 9999) {
St.thousand = St.number / 1000;
St.hundreds = St.number / 100;
St.dozens = St.number / 10;
St.units = St.number / 1;
cout << "Тысяч - " << St.thousand << ", сотен - " << St.hundreds << ", десятков - " << St.dozens << ", единиц - " << St.units;
break;
}
}
cout << "\n\n3)\n";
for (;;) {
cout << "Введите два натуральных числа <=10\n";
cin >> St.a >> St.b;
if (St.a >= 0 && St.a <= 10 && St.b >= 0 && St.b <= 10) {
St.amount_ab = St.a + St.b;
St.difference_ab = St.a - St.b;
St.composition_ab = St.a * St.b;
cout << "суммa: " << St.amount_ab << "\nразность: " << St.difference_ab <<"\nпроизведение: " << St.composition_ab << endl;
break;
}
}
system("pause > nul");
}
1:
for i in range (1000,10000):
i = str(i)
if int(i[3]) % 5 == 0:
print()
print(int(i), end=' ')
2:
n = int(input())
summ = 1
for i in range(1, n + 1):
summ *= abs(i)
print(summ)
3:
i = 1
a = 0
while(i <= 9999):
a += 1 / i
i += 2
i = 2
b = 0
while(i <= 10000):
b += 1 / i
i += 2
print(a - b)
4:
x, m, n= map(int, input().split())
summ = 1
for i in range(m,n+1):
if i % x == 0:
summ *= i
print(summ)
5:
lst = [int(i) for i in input().split()]
count = 0
summ = 0
for i in lst:
if len(str(i)) == 1:
count += 1
summ += i
print(summ / count)