c/c++算法练习2-韩信点兵

来源:互联网 发布:C语言死循环有什么后果 编辑:程序博客网 时间:2024/05/16 06:24

/** * 已知total对3的余数a,total对5的余b,total对7的余数c 求total. * taotal 大于10 不大于100 * */void handxin(int num1,int num2,int num3){        bool has = false;    int n =10;    while(n <= 100){        if(n % 3 == num1 && n % 5 == num2 && n % 7== num3 ){            printf("%d\n",n);            has = true;            break;        }                n++;    }        if(!has)        printf("No Number\n");    }


0 0
原创粉丝点击