Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Integer Sqrt

DZone's Guide to

Integer Sqrt

·
Free Resource
This code calculate the square root of a integer.


unsigned int sqrt(unsigned int n){
    unsigned int a;
    for (a=0;n>=(2*a)+1;n-=(2*a++)+1);
    return a;
}
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}