一、N-S流程图;
二、运行结果;
三、源代码;
# define _CRT_SECURE_NO_WARNINGS
# include <stdio.h>
int main()
{
//初始化变量值;
int n = 0;
int b = 0;
int s = 0;
int g = 0;
int m = 0;
//提示用户;
printf("请输入一个三位数:");
//获取用户输入数据;
scanf("%d", &n);
//赋值;
m = n;
//运算;
b = n / 100;
n = n % 100;
s = n / 10;
g = n % 10;
n = g * g * g + s * s * s + b * b * b;
//判断;
if (m == n)
{
//输出结果;
printf("%d是水仙花数!!!!\n", m);
}
else
{
//输出结果;
printf("%d不是水仙花数!!!!\n", m);
}
return 0;
}