第二套一

时间:2014-08-18 23:40:33   收藏:0   阅读:644
#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
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!