C Program to find Square Root of a Number

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

This program allows the user to enter any integer and then find the square root of that number using the math function sqrt().

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

C Program to find the 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 Result of %.2lf  =  %.3lf", num, result);
 
  	return 0;
}
 Please Enter any value : 3

 Result of 3.00  =  1.73