首页 > 其他 > 详细

第二套一

时间:2014-08-18 23:40:33      阅读:641      评论:0      收藏:0      [点我收藏+]
#include  <stdio.h>
int fun(int  x)
{ int  n, s1, s2, s3, t;
  n=0;
  t=100;
  while(t<=999){
    s1=t%10;  s2=(t/10)%10;  s3=t/100;
    if(s1+s2+s3==x)
    {  printf("%d ",t);
       n++;
    }
    t++;
  }
  return  n;
}
main()
{ int x=-1;
  while(x<0)
  { printf("Please input(x>0): ");  scanf("%d",&x);  }
  printf("\nThe result is: %d\n",fun(x));
}

第二套一,布布扣,bubuko.com

第二套一

原文:http://blog.csdn.net/u013116579/article/details/38667673

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!