|
|
back to boardWhats wrong whith this code Whats wrong whith this code > #include <stdio.h> #include <math.h> double i,j,n,m,k,a,p; int equal(double a,double b) { double c=a-b; if (c<0) c*=-1; if (c<0.0000001) return 1; return 0; } int main() { scanf ("%lf",&n); for (a=0;a<=n;a++) { double delta=sqrt((2*a-1)*(2*a-1)+8*n); p=(1-2*a+delta)/2; if (equal(p,floor(p))==1) { printf ("%.0lf %.0lf",a,p); return 0; } } return 0; } |
|
|