source:
Deliverables/D4.1/GCC/IntegerSquareRoot.c
@
185
Last change on this file since 185 was 165, checked in by , 10 years ago | |
---|---|
File size: 218 bytes |
Line | |
---|---|
1 | #include "stdio.h" |
2 | |
3 | unsigned int isqrt(unsigned int n){ |
4 | unsigned int a; |
5 | for (a = 0; n >= (2 * a) + 1; n -= (2 * a++) + 1); |
6 | return a; |
7 | } |
8 | |
9 | int main() |
10 | { |
11 | int i = 0; |
12 | i = isqrt(16); |
13 | printf("%d", i); |
14 | return 0; |
15 | } |
Note: See TracBrowser
for help on using the repository browser.