in turboc++
----------------------------------------------------------------------------------------
//program to get square root of a number using function.Use no argument and return some value
#include <stdio.h> //header file
#include<math.h>
#include<conio.h>
float square_root();//function prototype
int main() //main function
{
printf("square root=%f",square_root()); // function calliing with output
getch();
return 0; // returning 0 value
}
float 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
return square; //return of square
}
-------------------------------------------------------------------------
in codeblocks
--------------------------------------------------------------------------------------------------
//program to get square root of a number using function.Use no argument and return some value
#include <stdio.h> //header file
#include<math.h>
#include<conio.h>
float square_root();//function prototype
int main() //main function
{
printf("square root=%f",square_root()); // function calliing with output
getch();
return 0; // returning 0 value
}
float 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
return square; //return of square
}
----------------------------------------------------------------------------------------
//program to get square root of a number using function.Use no argument and return some value
#include <stdio.h> //header file
#include<math.h>
#include<conio.h>
float square_root();//function prototype
int main() //main function
{
printf("square root=%f",square_root()); // function calliing with output
getch();
return 0; // returning 0 value
}
float 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
return square; //return of square
}
-------------------------------------------------------------------------
in codeblocks
--------------------------------------------------------------------------------------------------
//program to get square root of a number using function.Use no argument and return some value
#include <stdio.h> //header file
#include<math.h>
#include<conio.h>
float square_root();//function prototype
int main() //main function
{
printf("square root=%f",square_root()); // function calliing with output
getch();
return 0; // returning 0 value
}
float 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
return square; //return of square
}
No comments:
Post a Comment