**New course!**Every coder should learn

**Generative AI!**

# Code for Armstrong number

I have wrote the code for armstrong number where each digits are raised to thhe power of total digits in the number Please help it because I'm not getting the correct code #include <iostream> using namespace std; float power(int base, int exp) { float n = 1.0; for (int i = 0; i < exp; i++) { n = n * base; } return n; } void arm(int a) { int count = 0, rem = 0; int num=0; while (a > 0) { a /= 10; count++; } cout << count << endl; while (a > 0) { rem = a % 10; num =num+ power(rem, count); a /= 10; //cout << num << endl; } cout << num; } int main() { cout << "Enter the number "; int n; cin >> n; arm(n); return 0; }