第九题
作者:互联网
第九题:判断一个数是否为"水仙花数",所谓"水仙花数"是指一个三位数其各位数字的立方和等于该数本身。
#include"stdio.h"
void main()
{
int i,j,k,n;
printf(“please input the n:\n”);
scanf("%d",&n);
printf("\n");
i=n/100;
j=(n-100*i)/10;
k=n%10;
if(i*i*i+j*j*j+k*k*k==n)
printf("the %d is Narcissistic number!\n",n);
else
printf("the %d is not Narcissistic number!\n",n);
}
标签:10,number,printf,100,第九,水仙花,Narcissistic 来源: https://blog.csdn.net/m0_54639703/article/details/113354171