source file name: Armstrong1.CPP
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
int main()
{
int n,d;
int sum=0,temp;
clrscr();
cout<<"\n enter any 3 digit number: ";
cin>>n;
temp=n;
while(n>0)
{
d=n%10;
sum=sum+(d*d*d);
n=n/10;
}
if(sum==temp)
cout<<"\n given no is Armstrong no ";
else
cout<<"\n given no is not Armstrong no ";
return 0;
}
output:
0 Comments
Post a Comment