-->
Showing posts with label program to get square root of a number using function.. Show all posts
Showing posts with label program to get square root of a number using function.. Show all posts

program to get square root of a number using function.

using codeblocks
-----------------------------------------

//program to get  square root of a number using function.
#include <stdio.h>  //header file
#include<math.h>
void square_root();//function prototype
int main()                 //main function
{
    square_root();          // function calliing
    return 0;             // returning 0 value
}

void square_root()      //function body line/definition
{
    float n,square;       // initilizating value 1
    printf("enter value");// display of those value
    scanf("%f",&n);
   
        square=sqrt(n);            // finding sum of two numbers
        printf("square root=%f\n",square);//display of that sum
     
}
-------------------------------------------------------------------------------------------------
using turbo c++
-------------------------------------------------------------------------------------------------
//program to get  square root of a number using function.
#include <stdio.h>  //header file
#include<math.h>
#include<conio.h>
void square_root();//function prototype
void main()                 //main function
{
    square_root();          // function calliing
    getch();             // holds the output
}

void square_root()      //function body line/definition
{
    float n,square;       // initilizating value 1
    printf("enter value");// display of those value
    scanf("%f",&n);
   
        square=sqrt(n);            // finding sum of two numbers
        printf("square root=%f\n",square);//display of that sum
     
}