Showing posts with label armstrong. Show all posts
Showing posts with label armstrong. Show all posts

Thursday, 18 April 2019

Program to Find if number is Armstrong Number or Not in C++ C

#include<bits/stdc++.h>
using namespace std;
bool isArm(int num)
{
int ans=0;
int p=num;
while(num>0)
{
int x=num%10;
ans+=x*x*x;
num/=10;
}
if(p==ans)
return 1;
return 0;
}
int main()
{
cout<<isArm(371);
}

Amazon1Ads