|
|
back to boardCommon BoardWhy can't I use sqrt() ? Posted by mag 10 Jan 2003 18:33 Hi. I've included <math.h> and have tried to use sqrt(). Why I wasn't allowed to do this and have got CE? Source code follows: #include <stdio.h> #include <math.h> int getint() { int i; scanf("%d", &i); return i; } int main() { int i = getint(); while(i--) { int n = getint() - 1; int nn = sqrt(n+n); if(nn*(nn+1) == n+n) printf("1\n"); else printf("0\n"); } } |
|
|