ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

Help what is wrong? C++
Posted by Misha 25 Jan 2015 15:09
This is my code.


#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
    long double a;
    cin >> a;
    cout << fixed << setprecision(4) << sqrt(a) << endl;
    return 0;
}
Re: Help what is wrong? C++
Posted by PimpMyTest 26 Jan 2015 16:51
In my opinion the problem is that the user should be able to insert a set of numbers, while in your code you can only give 1 value in input.
Re: Help what is wrong? C++
Posted by dream 23 Mar 2015 12:49
as i known you can insert the code "main()" on the line of "return 0;"
Re: Help what is wrong? C++
Posted by Hassan52 22 May 2015 14:48
the wrong is your data type try to store the double side alone and the integar alone and then calculate them into output :D

like
long long int_side = sqrt(a);

double float_side = sqrt(a)-int_side;

cout << int_side+float_side ;
Re: Help what is wrong? C++
Posted by Abhinav Garg 26 May 2015 19:15
You also have to print result in reverse order. Square root of number you read last should be displayed first.

Edited by author 26.05.2015 19:16

Edited by author 26.05.2015 19:16