C Chapters

C program to demostrate the standard library function sqrt().

Types of Functions - Functions
/* Standard Library Function in C Language */

#include <stdio.h>
#include <conio.h>
#include <math.h>

int main() 
{
   float num, root;
   printf("Enter a number: "); /* printf() function for write text */
   scanf("%f", &num); /* Scanf() function for take input*/
   root = sqrt(num);  /* Computes the square root of num and stores in root.*/

   printf("Square root of %.2f = %.2f", num, root);
   return 0;
}

Output :
Enter a number: 4
Square root of 4.00 = 2.00

Leave a comment
Recent Comments
No Comments