How to make square root program in c language without liabirary function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to make square root program in c language without liabirary function

How to make square root program in c language without liabirary function

30th Apr 2018, 5:12 PM
Mak Khan
Mak Khan - avatar
3 Answers
+ 2
The best methods and how they compare https://code.sololearn.com/cJCYuZOgG3vC/?ref=app
30th Apr 2018, 5:27 PM
VcC
VcC - avatar
+ 1
are you run this code
30th Apr 2018, 5:26 PM
Mak Khan
Mak Khan - avatar
0
#include<stdio.h> int main() { float m,n=0.0001; float num; // This is taken small so that we can calculate upto decimal places also printf("ENTER A NUMBER : "); scanf("%f",&num); for(m=0;m<num;m=m+n) { if((m*m)>num) { m=m-n; // This if() is used to calculate the final value as soon as the square of the number exceeds break; // the number then we deduct the value exceeded and stop the procedure using break; this is our final value which is stored in m; } } printf("%.2f",m); getch(); return 1; }
30th Apr 2018, 5:47 PM
Mak Khan
Mak Khan - avatar