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
The square root of 64 = 8
No comments:
Post a Comment