In: Computer Science
Create your own function in C that accepts one input number and returns a double number. The themes for the functions should be one of the following: Calculates 3.14 times of the square of input number. For example, if 2 is input then 12.56 should be returned. (e.g. 3.14*2*2 = 12.56)
#include<stdio.h>
int main()
{
int x;
double y;
printf("Enter a number ") ;
scanf("%d",&x) ;
printf("\nEntered number is %d", x) ;
y=3.14*x*x;
printf("\nThe required value is %lf", y) ;
return 0;
}
$gcc -o main *.c
$main
Enter a number:
Entered number is 2
The required value is 12.560000