C program to find square root of a number

The square root of a number is the value of power half (1/2) of that number.

It is the number that we multiply by itself to get the original number.

It is represented by √

Program


#include <stdio.h>
#include <math.h>

int main() {
   double number, squareRoot;

   printf("Enter a number to find its square root : ");
   scanf("%lf", &number);

   // computing the square root
   squareRoot = sqrt(number);

   printf("Square root of %.2lf =  %lf", number, squareRoot);

   return 0;
}

Output 1


Enter a number to find its square root : 25
Square root of 25.00 =  5.000000

Output 2


Enter a number to find its square root : 45
Square root of 45.00 =  6.708204

Post a Comment

0 Comments