
Adozar
5 год назад
С помощью оператора FOR вывести на экран:1) целые числа 1, 3, 5, ..., 21 в строку через пробел2) целые числа 10, 12, 14 ..., 60 в обратном порядке в столбик3) кубы всех целых чисел из диапазона от A до B (A<=B) в обратном порядке.
ОТВЕТЫ

Jordanka
Oct 24, 2020
:
#include
using namespace std;
int main()
{
int a, b, x;
cin >> a>> b>> x;
for (int i=a; i<=b; ++i)
{
if (i%10 == x)
cout << i <<"t";
}
cout << endl;
int i=a;
while (b>=i)
{
if (i % 10 == x)
cout << i <<"t";
++i;
}
cout << endl;
do
{
if (a % 10 == x)
cout << a <<"t";
++a;
} while (b>=a);
system("pause");
return 0;
}
#include
using namespace std;
int main()
{
int a, b, x;
cin >> a>> b>> x;
for (int i=a; i<=b; ++i)
{
if (i%10 == x)
cout << i <<"t";
}
cout << endl;
int i=a;
while (b>=i)
{
if (i % 10 == x)
cout << i <<"t";
++i;
}
cout << endl;
do
{
if (a % 10 == x)
cout << a <<"t";
++a;
} while (b>=a);
system("pause");
return 0;
}
101
Смежные вопросы: