我是靠谱客的博主 魔幻煎饼,这篇文章主要介绍C语言while与if嵌套陷入死循环,我是初级菜鸟麻烦帮忙指正,源代码如下,现在分享给大家,希望可以做个参考。

#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[])
{
int n = 100;
int a, b, c;

    while (n <= 999) 
    {
            a = n / 100;
            b = n / 10 % 10;
            c = n % 10;

            //if (a*a*a + b*b*b + c*c*c == n) 
            if (pow(a, 3) + pow(b, 3) + pow(c, 3) == n)
             {
               printf("%dn", n);
             }     
            n++;
    }

    return 0;

}

最后

以上就是魔幻煎饼最近收集整理的关于C语言while与if嵌套陷入死循环,我是初级菜鸟麻烦帮忙指正,源代码如下的全部内容,更多相关C语言while与if嵌套陷入死循环内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(110)

评论列表共有 0 条评论

立即
投稿
返回
顶部