#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n, s = 0;
cin >> n;
while (n > 0)
s += pow(n % 10, 3);
n = n / 10;
}
cout << s;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n, s = 0;
cin >> n;
while (n > 0)
{
s += pow(n % 10, 3);
n = n / 10;
}
cout << s;
return 0;
}