|
发表于 2019-11-7 20:18:16
|
显示全部楼层
本楼为最佳答案
本帖最后由 bin554385863 于 2019-11-8 10:24 编辑
- #include <stdio.h>
- int main(int argc, char const *argv[])
- {
- int result = 0, max = 0;
- printf("请输入查找的范围\n");
- scanf("%d", &max);
- for (size_t i = 1; i < max; i++)
- {
- if (__INT32_MAX__ / i <= i)//避免数字溢出
- {
- printf("基数[%d]过大", i);
- break;
- }
- else
- {
- for (size_t j = 0; j < i; j++)
- {
- if (i * i - j * j == 68)
- {
- printf("%d -- %d\n", i * i, j * j);
- result = j * j - 100;
- printf("所求的数字是[%d]\n", result);
- }
- }
- }
- }
- return 0;
- }
复制代码
----------------------------------------------------------------------
Microsoft Windows [版本 10.0.18363.418]
(c) 2019 Microsoft Corporation。保留所有权利。
E:\Users\admin\Documents\VScode>c:\Users\admin\.vscode\extensions\ms-vscode.cpptools-0.26.1\debugAdapters\bin\WindowsDebugLauncher.exe --stdin=Microsoft-MIEngine-In-5emtsae5.541 --stdout=Microsoft-MIEngine-Out-ogadsgcr.vij --stderr=Microsoft-MIEngine-Error-jxggempy.weo --pid=Microsoft-MIEngine-Pid-a53zolsb.dco --dbgExe=D:\MinGW\bin\gdb.exe --interpreter=mi
请输入查找的范围
100000
324 -- 256
所求的数字是[156]
基数[46341]过大
E:\Users\admin\Documents\VScode> |
|