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

Write a program to generate the Fibonocci Series in C++.

0 Answers   Accenture,


What Are The Differences Between A C++ Struct And C++ Class?

2 Answers   Wipro,


Describe the different styles of function prototypes in C++.

0 Answers   Adobe,


How to invoke a C function using a C++ program?

0 Answers   Alter,


Define an Abstract class in C++?

0 Answers  


Write a C++ Program to Find Sum and Average of three numbers.

1 Answers  


What are the fundamental features of an object-oriented language?

0 Answers   Accenture,


Name the operators that cannot be overloaded.

1 Answers   Wipro,


Identify the error in the following program. include<iostream> using namespace std; void main() { int num[]={1,2,3,4,5,6}; num[1]==[1]num ? cout<<"Success" : cout<<"Error"; }

1 Answers  


C++ supports multiple inheritance. What is the “diamond problem” that can occur with multiple inheritance? Give an example.

0 Answers  


what is a pragma in C++?

0 Answers   Aspire,


What is a COPY CONSTRUCTOR and when is it called?

0 Answers   IBS,


Categories