8. If b is equal to s, then print “it is an Armstrong number” else print “it is not an Armstrong
number”
9. Exit
The resulting program is as follows:
void main( )
{
int num, b, s=0, r;
printf( “Enter a number:”);
cin >> num;
b = num;
while (num > 0)
{
r = num % 10;
s=s+ (r *r*r);
num = num/10;
}
if ( b = =s)
printf(“b is an Armstrong number”);
else
printf(“b is not an Armstrong number”);
}
}
Do'stlaringiz bilan baham: