Function Main
Declare Integer Num
Declare Real X
Output "Enter a number: "
Input Num
If Num > 1
Assign X = Num
Else
Assign X = 1
End
While X * X > Num
Assign X = (1 / 2) * ( X + ( Num / X ) )
End
Output "The square root of the number " & Num & " is: " & X
End
#include <stdio.h>
int main() {
int Num;
double X;
printf("Enter a number: \n");
scanf("%d", &Num);
if (Num > 1) {
X = Num;
} else {
X = 1;
}
while (X * X > Num) {
X = (double) 1 / 2 * (X + Num / X);
}
printf("The square root of the number %d is: %f\n", Num, X);
return 0;
}
I am Md. Anisur Rahman. I have completed Cyber Security for MSCSE at United International University in 2022.I have completed PGDIT from IIT, Jahangirnagar University in 2020. I'm a Head of IT at Programming24 School.
View all posts by Md. Anisur Rahman