题解 | #包含数字9的数#

包含数字9的数

http://www.nowcoder.com/practice/0948f4f3344c452f843afd3585dd0f8d

#include<stdio.h>
int main(){
    int one,ten,hundred,thousand,k=0;
    for(int i=1;i<=2019;i++){
        one = i%10;
        ten = i/10%10;
        hundred = i/100%10;
        thousand = i/1000;
        if(one==9||ten==9||hundred==9||thousand==9) k++;
    }printf("%d\n",k);
}
全部评论

相关推荐

点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务