Write a C program to input any number from user and find square root of the given number. How to calculate square root of any number in C programming.

Input number: 9

Output: 3

Happy coding ;)

**Example:**Input number: 9

Output: 3

### Required knowledge

Fundamentals of C, Data types, Talking user input in C#### Square root

Square root is a number which produces a specified quantity when multiplied by itself.### Program

/** * C program to find square root of a number */ #include <stdio.h> #include <math.h> int main() { double num, root; // Reads the number to find square root printf("Enter any number to find square root: "); scanf("%lf", &num); //Calculates square root of num root = sqrt(num); printf("Square root of %.2lf = %.2lf", num, root); return 0; }

Output

Enter any number to find square root: 144

Square root of 144.00 = 12.00

Square root of 144.00 = 12.00

Happy coding ;)

### You may also like

- Basic programming exercises index.
- C program to find area of rectangle.
- C program to find diameter, circumference and area of circle.
- C program to convert length from centimeter to meter and kilometer.
- C program to convert temperature from Celsius to Fahrenheit.
- C program to convert days to years, weeks and days.
- C program to find power of a number x^y.
- C program to calculate area of equilateral triangle.
- C program to calculate total, average and percentage.
- C program to calculate Simple Interest.
- C program to calculate Compound Interest.
- C program to check whether a number is even or odd.
- C program to check leap year.
- C program to check whether a character is alphabet, digit or special character.

< code >< pre > -- Your source code -- < /pre >< /code > (Remove spaces from pre and code tags).