Задачу проще всего решить, уже имея набор этих чисел, а их не так много и их можно найти в интернете)
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector <long long int> armstrong = {1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727, 93084, 548834, 1741725, 4210818, 9800817, 9926315, 24678050, 24678051, 88593477, 146511208, 472335975, 534494836, 912985153, 4679307774};
long long int n;
int l = armstrong.size();
cin >> n;
for (int i = 0; i < l && armstrong[i] <= n; ++i)
cout << armstrong[i] << '\n';
return 0;
}
Uses graphABC;beginsetwindowsize(600,500);setbrushcolor(clgreen);Ellipse(100,430,500,130);setbrushcolor(clNavy); Ellipse(250,260,220,310);Ellipse(350,260,380,310);setbrushcolor(clblack);Ellipse(270,330,330,370);line(300,370,300,400);Arc(300,280,120,220,-40); line(120,240,150,40);line(150,40,280,150);line(280,150,120,240);line(320,150,480,240);line(480,240,450,40);line(450,40,320,150);floodfill(200,100,clblack);floodfill(400,100,clblack);line(50,350,200,350);line(30,340,190,340);line(10,330,180,330); line(410,330,570,330);line(400,340,560,340);line(390,350,550,350); line(250,240,220,150);line(240,240,180,80);line(230,240,180,150); line(350,240,380,150);line(360,240,430,80);line(370,240,430,150); end.