Judged within 100,000, an integer plus 100 is a complete square number, plus 168 is a complete square number, which is calculated

Source: Internet
Author: User

Title: An integer, which is a complete square after the number, plus 168 is a complete square number, what is the number?

Program analysis: In the judgment within the million, first of all, add the number after the prescription, and then add the number plus 268 after the root , if the result of the root to meet the following conditions , which is the result.

Program Source code:

#include <stdio.h>

#include <math.h>


int main ()

{

long int i, x, y;

for (i = 1; i<100000; i++)

{

x = sqrt (i + 100);

y = sqrt (i + 268);

if (x*x = = i + +) && (Y*y = = i + 268)/* * If the square root of a number equals that number, this indicates that the number is the total square number */

{

printf ("%ld\n", I);

}

}

System ("pause");

return 0;

}

Operation Result:

21st

261

1581

Please press any key to continue ...


This article is from the "Rock Owl" blog, please be sure to keep this source http://yaoyaolx.blog.51cto.com/10732111/1765892

Judged within 100,000, an integer plus 100 is a complete square number, plus 168 is a complete square number, which is calculated

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.