source: Deliverables/D4.1/GCC/IntegerSquareRoot.c @ 557

Last change on this file since 557 was 165, checked in by mulligan, 9 years ago

Some example C programs that the emulator can run.

File size: 218 bytes
Line 
1#include "stdio.h"
2
3unsigned 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
9int 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.