Last active
December 7, 2015 15:40
-
-
Save MinhasKamal/fc6fdee1c661cc8d1c4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Name: Minhas Kamal | |
* Date: 02-Apr-2013 | |
**/ | |
#include <stdio.h> | |
float sqrt(int i); | |
int main() | |
{ | |
int x; | |
printf("Enter your integer: "); | |
scanf("%d", &x); | |
printf("%f", sqrt(x)); | |
return 0; | |
} | |
float sqrt(int i) | |
{ | |
float x=1.0; | |
float y; | |
for( ; y-x>0.0001 || x-y>0.0001; ++x) | |
{ | |
y=(x+i/x)/2; | |
} | |
return y; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment