Write a C++ Program to find Square Root of a number using sqrt() function.



Write a C++ Program to find Square Root of a number using sqrt() function...

Answer / hr

Solution:
/* C++ Program to find Square Root of a number using sqrt() function */
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
float sq,n;
cout<<"Enter any positive number :: ";
cin>>n;
sq=sqrt(n);
cout<<"
Square root of Entered Number [ "<<n<<" ] is :: "<<sq<<"
";
return 0;
}
Output:
/* C++ Program to find SquareRoot of a number using sqrt() function */
Enter any positive number :: 10000
Square root of Entered Number [ 10000 ] is :: 100
Process returned 0

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ Interview Questions

How to input string in C++

0 Answers  


Write a program that ask for user input from 5 to 9 then calculate the average

0 Answers   IBS,


What are issues if we mix new and free in C++?

0 Answers  


How does stack look in function calls? Write a recursive function call, how will the stack look like?

0 Answers   Adobe,


CDPATH shell variable is in(c-shell)

0 Answers   Siemens,


When would you use a pointer? A reference?

0 Answers   Amazon,


Write a syntax and purpose of switch statement.

0 Answers   Agilent,


What is the meaning of the following declaration: int *const *const *i?

0 Answers   Adobe,


How will you print a list of all unique words from a string which may contain repeated words?

0 Answers   Adobe,


Difference between Call by pointer and by reference.

0 Answers   Adobe,


Can we call a virtual function from a constructor?

1 Answers  


What are the advantages/disadvantages of using inline and const?

0 Answers   Amazon,


Categories