Ответ:
173₁₀ = = 173₁₀
173₁₀ = 5*8⁰ + 5*8¹ + 2*8² = 255₈
A2₁₆ = 2*16⁰ + A*16¹ = 162₁₀
162₁₀ = 0*2⁰ + 1*2¹ + 0*2² + 0*2³ + 0*2⁴ + 1*2⁵ + 0*2⁶ + 1*2⁷ = 10100010₂
Объяснение:
желательно указывать также основание исходных чисел
#include <iostream>
#include <Windows.h>
using namespace std;
int main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
char s[128]; size_t i = 1; int c=0;
cin.getline(s, 128); s[strlen(s)] = ' ';
for(size_t i=1; i<strlen(s); i++)
if (s[i] == 'а' && s[i - 1]!=' ' && (s[i + 1] == ' ' || s[i + 1] == ',' || s[i + 1] == '.' || s[i + 1] == '!' || s[i + 1] == '?'))
c++;
cout << c << endl;
system("pause");
return 0;
}
Писал на Visual Studio 2017
// PascalABC.NET 3.4
begin Range(20,10,-1).Println end.
Это полная программа.
Ответ:
Ничего сложного
Объяснение:
1.
#include <iostream>
using namespace std;
int main() {
setlocale(LC_ALL, "rus");
int that = 1, index = 1, sum_index = 0, sum_element = 0;
while (that != 0) {
cin >> that;
if (that % 2 == 0) sum_element += that;
if (index % 2 == 0) sum_index += that;
index++;
}
cout << "Сумма четных элементов = " << sum_element << endl;
cout << "Сумма элементов с четными индексами = " << sum_index;
}
2.
#include <iostream>
using namespace std;
void cycle_for() {
int sum = 0;
for (int i = 50; i <= 150; i++) if (i % 4 == 0) sum += i * i;
cout << "Cycle for: " << sum << endl;
}
void cycle_while() {
int i = 50, sum = 0;
while (i <= 150) {
if (i % 4 == 0) sum += i * i;
i++;
}
cout << "Cycle while: " << sum << endl;
}
void cycle_do_while() {
int i = 50, sum = 0;
do {
if (i % 4 == 0) sum += i * i;
i++;
} while (i <= 151);
cout << "Cycle do while: " << sum;
}
int main() {
cycle_for();
cycle_while();
cycle_do_while();
}