Write a program to find Square Root of any number :-

//Square Root of any number

void main()
double num,ans; 
printf("Enter any number: "); 

printf("\n Square root of %lf is: %lf",num,ans); 


Enter any number: 144
Square root of 144.000000 is: 12.000000


Explanation of Program:-

1. First it read the value from user by scanf().
2. "sqrt" is a predefined function in math.h header file, it is used for calculate power of any number.

Previous Next

NOTE:- We can also find Square root, multiply number by 0.5 because square root of any number means power of 1/2 and 1/2=0.5.