如果一个正整数等于其各个数字的立方和,则该数称为阿姆斯特朗数.如:407=43+03+73 就是一个C语言编程
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 01:40:28
如果一个正整数等于其各个数字的立方和,则该数称为阿姆斯特朗数.如:407=43+03+73 就是一个C语言编程
如果一个正整数等于其各个数字的立方和,则该数称为阿姆斯特朗数.如:407=43+03+73 就是一个
C语言编程
如果一个正整数等于其各个数字的立方和,则该数称为阿姆斯特朗数.如:407=43+03+73 就是一个C语言编程
楼主应该加个条件正整数是三位,这样才能和后面的立方和对应起来.阿姆斯特朗数的定义为:一个n位正整数等于其各位数字的n次方之和.
三位数的情况也叫水仙花数.
程序如下:
#include
int main()
{
int i,t,k,a[3];
printf("There are follwing armstrong number smaller than 1000:\n");
for(i=2;i=10;t++) /*截取整数i的各位(从高向低位)*/
{
a[t]=(i%k)/(k/10); /*分别赋于a[0]~a[2}*/
k/=10;
if(a[0]*a[0]*a[0]+a[1]*a[1]*a[1]+a[2]*a[2]*a[2]==i)
/*判断i是否为阿姆斯特朗数*/
printf("%5d",i); /*若满足条件,则输出*/
}
printf("\n");
}
*运行结果
There are following armstrong number smaller than 1000:
153 370 371 407
Something About Nike Air Jordans
Nike Air Jordan is named after the American basketball legend ‘His Airness’,China Jordan Shoes, Michael Jordan. It was the first in the series to hit the market an...
全部展开
Something About Nike Air Jordans
Nike Air Jordan is named after the American basketball legend ‘His Airness’,China Jordan Shoes, Michael Jordan. It was the first in the series to hit the market and take the public sentiment by storm. To say Air Jordans was a runaway success is an understatement which you will see looking at the way people were prepared to pay steep penalties, ignoring NBA rules, rather than having to play matches without wearing them.
Given the penchant for innovation,Jordan Shoes On Sale, the creators of Nike Air Jordan have done it again when the introduced Air Force 1 Fusion. It was a hybrid shoe conceptualized by merging the craftsmanship and vibrancy of Air Jordans and basic designs of Air Force 1 on the latter’s proven platform. For once,Very Cheap Jordans, it is easy to tell why the makers of Nike Air Jordan have been trying hard to fuse two different sneakers into one if you see how fast they went disappearing from stands. By combining Air Jordans and Air Force 1, Nike has hit two birds in one stone. Air Jordan and Air Force 1 Fusion is a definite boon for those who were caught between having to choose from Air Jordans or Air Force 1s.
See More:
air jordan Chris Paul
air jordan The Story of Jordan Brand
?Cheap Jordans Nike SB Zoom Koston 1
air jordan Air Jordans Also Enter Into The Movied
收起