|
|
back to boardwhy its gvng wrong answer? Posted by tanu 20 Mar 2011 10:41 #include<iostream> #include<vector> #include<cmath> using namespace std; int main(){ double x; int i=0; double a[100]; while(cin>>x) { a[i]=(sqrt(x)); i++; } for(int j=i-1;j>=0;j--)printf("%.4f\n",a[i]); return 0; } Re: why its gvng wrong answer? 1) Change double to long double. 10^18 is much more, than double type can contain. 2) The size of your array may be greater than 100. |
|
|