A simple square root calculator
Hello all my dear friends,
This is a very simple calculator I made to find the square root of an entered number.
It works fine and errors free
The calculator keeps running until the user enter 0 to quit the program
I hope the code is free of mistakes
Code:
#include <stdio.h>
#include <math.h>
int main()
{
float x;
do {
printf("Square Root Calculator\n\n");
printf("\nNote:\nThe square root of 1 is 1, and 0 is 0\n\n");
system("pause");
system("cls");
printf("\nEnter a number to find the sqauare root, 1 to go back to main or 0 to exit:\n");
scanf("%f", &x);
if(x != 0 && x > 1){
x = sqrt(x);
printf("\n\n\nThe sqaure root of the entered number is %.1f\n\n\n", x);
}
else if(x == 1){
system ("cls");
continue;
}
else if(x == 0){
exit(0);
}
system ("pause");
system ("cls");
} while (x != 0);
}
Please try it and give me your feedback
Thank you :)