|
|
back to boardwhy does not work?!!! Posted by sonic 31 Aug 2005 08:36 #include <iostream.h> #include <math.h> void main() { short length; int input; char i; cin >> length; for ( i = 0; i < length; i++ ) { cin >> input; if ( (int)(sqrt((double)(8*input - 7))) == sqrt((double)(8*input - 7)) ) cout << '1'; else cout << '0'; } } Re: why does not work?!!! Posted by swgr 3 Feb 2006 13:17 the problem is: sqrt((double)(8*input - 7)) it should be: sqrt((double)(8*(double)(input)-7)) |
|
|