C Program to find Square Root of a Number

How to write a C Program to find Square root of a Number using sqrt and without using sqrt function with example?.

This C Program allows the user to enter any integer and then finds the square root of that number using math function sqrt()

#include<stdio.h>
#include<math.h>
 
int main()
{
  	double number, result;
 
 	printf(" \n Please Enter any Number to find Square root : ");
  	scanf("%lf", &number);
  
  	result = sqrt(number);
  
  	printf("\n Square Root a given number %.2lf  =  %.2lf", number, result);
 
  	return 0;
}
C Program to find Square root of a Number 1

C Program to find Square root of a Number without using sqrt

This program uses the math function pow to find the square root of a number. As we all know √number = number½

#include<stdio.h>
#include<math.h>
 
int main()
{
	double num, result;
 
  	printf(" \n Please Enter any value : ");
  	scanf("%lf", &num);
  
  	result = pow(num, 0.5);
  
  	printf("\n SquareRoot of %.2lf  =  %.3lf", num, result);
 
  	return 0;
}
 Please Enter any value : 3

 SquareRoot of 3.00  =  1.73