完全平方数的判断(包含浮点数的四舍五入问题)

版权声明:有善始者实繁,能克终者盖寡。 https://blog.csdn.net/weixin_43987810/article/details/86365985
#include<stdio.h>
#include<math.h>

int main()
{
    for(int i = 1; i <= 9; i++)
        for(int j = 0; j <= 9; j++)
        {
            int m = 1100 * i + 11 * j;
            int n = floor(sqrt(m) + 0.5);
            if(n * n == m)
                printf("%d", m);
        }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_43987810/article/details/86365985
今日推荐