码迷,mamicode.com
首页 > 其他好文 > 详细

输出0到999之间的水仙花数

时间:2015-10-05 19:36:47      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:include   水仙花   

#include<stdio.h>
#include<math.h>
int main()

 int a,b,c,t;
 int i=0;
 for(i=100;i<999;i++)
 {  a=i/100;
    t=i%100;
    b=t/10;
    c=i%10;
    if(pow(a,3)+pow(b,3)+pow(c,3)==i)
   printf("%d\n",i);
 }
 return 0;

                                                                                                                                                                                                                                                                                                                                                                                                

本文出自 “零点时光” 博客,请务必保留此出处http://10741764.blog.51cto.com/10731764/1700253

输出0到999之间的水仙花数

标签:include   水仙花   

原文地址:http://10741764.blog.51cto.com/10731764/1700253

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!