please help. what is the syntax to write the square root of the following √4*3.142*A in c plus plus programming language. A is a variable.
Asked
Active
Viewed 2,246 times
-8
-
4http://www.cplusplus.com/reference/cmath/sqrt/ – RogueBaneling Aug 07 '15 at 20:47
-
1Hi Michael! Welcome to SO! Before asking a question, you need to show us that you've put some effort into finding a solution. What research have you done? Where did it lead you? Where did you get stuck? – scohe001 Aug 07 '15 at 20:49
-
also see http://stackoverflow.com/questions/1727881/how-to-use-the-pi-constant-in-c – 1010 Aug 07 '15 at 20:50
-
4@RogueBaneling Or the even better reference: http://en.cppreference.com/w/c/numeric/math/sqrt – πάντα ῥεῖ Aug 07 '15 at 20:51
-
2@πάνταῥεῖ That's the reference for the C `sqrt`/`sqrtl`/`sqrtf`. Here's the corresponding page for C++: http://en.cppreference.com/w/cpp/numeric/math/sqrt – Emil Laine Aug 07 '15 at 20:59
-
@zenith And wut?? I've chosen that link consciously. – πάντα ῥεῖ Aug 07 '15 at 21:02
-
Hi Michael! Always feel free to search StackOverflow or the internet before posting. Often, you can save yourself a lot of effort and time by doing so. – Thomas Matthews Aug 07 '15 at 21:35
-
2@πάνταῥεῖ Why? The question is tagged C++. – Emil Laine Aug 07 '15 at 21:41
2 Answers
4
you can easily use sqrt(4*3.142*A)
but don't forget to add this first #include<cmath>

Andrew Meleka
- 93
- 1
- 10
0
****we have function for sqrt provided in math library.****
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
// √4*3.142*A
int A =10;
float result = sqrt(4*3.14*A);
cout<<result<<endl;
}
result==11.2071

Ccr
- 686
- 7
- 25