Beta Coder

Learn code like Beta Coder.

Breaking

Friday, September 11, 2020

C Program to Calculate square root n without using sqrt()

CALCULATE SQUARE ROOT N WITHOUT USING sqrt()

Calculate square root n without using sqrt()
In this program we learn how to calculate square root n without using sqrt() provided by user using C.
C program to calculate square root n without using sqrt()
// Calculate square root n without using sqrt()
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
	float n,r;
	clrscr();
	printf("\n Enter a number : ");
	scanf("%f",&n);
	r = pow(n,0.5);
	printf("\n The square root of %f = %f",n,r);
	getch();
}
OUTPUT:
   Enter a number : 64
   The square root of 64 = 8

No comments:

Post a Comment