Program for Armstrong Number in C++

Here you will get program for armstrong number in C++.

A number whose sum of digits raised to power n is equal to itself is called armstrong number. Here n is the total digits in the number.

For example, 153 is armstrong number as 153 = 1+ 5+ 33 = 1 + 125 +27.

Program for Armstrong Number in C++



Enter any number: 7
The given number is an armstrong number

15 thoughts on “Program for Armstrong Number in C++”

    1. The logic is absolutely correct, 1%10 = 1. You are telling wrong logic. Just run the program, it is working fine.

  1. #include
    using namespace std;

    int cnt(int num){
    int c=0;
    return c;

    int chkArm(int base,int pwr){
    int result,temp;

    temp = base%10;
    cout << " temp is — " << temp << endl;
    cout << "result is — "<<result << endl;
    return result;
    int main()
    int num,c,result;

    cout <>num;


    cout << "\nYou entered " << c << " digits." <<endl;

    result = chkArm(num,c);

    cout << "Result is : " << result << endl;

    Can some one please tell me that is there any problem in my code ? or if is it correct why its not giving the correct result?

Leave a Comment

Your email address will not be published. Required fields are marked *