Skip to main content

Simple C program to get square root of any number

Square Root is a factor of a number that, when multiplied by itself, gives the original number. This C Program will find squareroot of any number. C language provides math.h library file to perform various mathematical operations like square, power.

For example, if we take an example of 25 then the square root is 5.
5*5 = 25

// Program for math operations like power, square root.
#include <stdio.h>
#include <math.h>
int main() {
    // declaring variable in double
    double num,sr;
    printf("\nEnter number to find square root\t");
    scanf("%lf",&num);
    sr = sqrt(num);
    printf("\n\nSquare root of number %lf is %lf",num,sr);
    return 0;
}

Output

Enter number to find square root	625
Square root of number 625.000000 is 25.000000