badge

C++ program to implement ARMSTRONG NUMBER PROGRAM

Program in c++ language for ARMSTRONG NUMBER...

DESCRIPTION:-  This program will tell you that entered number is an armstroong number or not.
                                Simple funda is used that .i Just take a function name void cal(int num,int check)
                                and use some method inside it.


OUTPUT :



SOURCE CODE:-

#include<iostream>
#include<conio.h>

using namespace std;


void cal(int num,int check)
{
    
    static int sum=0;
    if(num!=0)
    {
        int x=num%10;
        int cub=x*x*x;
        sum=sum+cub;
        num=num/10;
        
       cal(num,check);  
    
    }
    else
    
    if(sum==check)
    {
        cout<<"\nYes it is an armstrong number:";
    }
    else
    {
        cout<<"\nNOt an armstrong number:";
    }
    
}



int main()
{
    int num;
    cout<<"\nEnter the number:";
    cin>>num;
cal(num,num);
getch();

}




/* IF U FOUND ANY PROBLEM IN THIS PROGRAM  OR IF YOU HAVE ANY QUERY RELATED THIS PROGRAM THEN PLEASE COMMENT IN THIS POST OR YOU CAN DIRECTLY MAIL ME ON piyushkhandelwal029@gmail.com . */

THANKU.


SHARE

Admin

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments: