Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

  1. Home >
  2. All Categories >
  3. Computers & Internet >
  4. Programming & Design >
  5. Resolved Question
jerry l jerry l
Member since:
January 28, 2008
Total points:
62 (Level 1)

Resolved Question

Show me another »

C++ program to find square root?

code to compute a c++ program that will accept input from a user and find the square root
rr ann by rr ann
Member since:
February 06, 2009
Total points:
705 (Level 2)

Best Answer - Chosen by Voters

/* sqrt example */
#include <stdio.h>
#include <math.h>

int main ()
{
double param, result;
param = 1024.0;
result = sqrt (param);
printf ("sqrt(%lf) = %lf\n", param, result );
return 0;
}
Output:

sqrt(1024.000000) = 32.000000

I hope this helps
100% 1 Vote

There are currently no comments for this question.

Other Answers (2)

  • Alex V by Alex V
    Member since:
    August 21, 2008
    Total points:
    2,834 (Level 4)
    include <cmath>
    #include <iostream>
    int main()
    {
    int a;
    std::cout << "enter a: ";
    std::cin >> a;

    std::cout << std::sqrt(double(a)) << std::endl;
    }
    0% 0 Votes
  • sinkablehail1978 by sinkable...
    Member since:
    March 30, 2006
    Total points:
    6,721 (Level 5)
    there is a c++ library function called sqrt(<input value>) that you can use for this.
    0% 0 Votes

Answers International

Yahoo! does not evaluate or guarantee the accuracy of any Yahoo! Answers content. Click here for the Full Disclaimer.

Help us improve Yahoo! Answers. Send Feedback