C Program Code:
#include<stdio.h>
#include<math.h>
int main()
{
int number;
double squareRoot;
printf(" Find Square Root of a Number in C \n");
printf(" Enter a Number: ");
scanf("%d", &number);
if (number > 0)
{
squareRoot = sqrt(number);
printf(" Square Root of Number %d is %.2f \n", number, squareRoot);
}
else
{
printf(" Invalid Input, Please Enter Positive Number \n");
}
printf(" Press enter to continue...\n");
fflush(stdin);
getchar();
return 0;
}
|
C Program