Writing square root in cplusplus

Hi,
square root is in math.h (C include) or cmath (C++ version of math.h) and is a function named sqrt.

1
2
3
4
5
6
7
8
9
#include <cmath>
#include <iostream>

int main()
{
    int x = 25;
    std::cout << sqrt(x) << std::endl;
    return 0;
}


output : 5
Last edited on
Hello kbz8,

Now that you have changed your post to the code of someone else. Do you have a question?

Andy
Andy, @kbz8 was ANSWERING the original question of one of those irritating posters who post an innocuous-looking question and subsequently edit it to include spam. (Prompting immediate deletion.)
Topic archived. No new replies allowed.