Write a program that calculates the area of a circle from the radius. The radius will be an integer read in from the keyboard. You will need to use the function pi(). According to my understanding, the functions accept a double argument and returns a double. But I was asked to use the integer for radius, so how do I pass it to the function? Another question is there a function square() because when I inserted a square it was undefined. I have been told that my codes are horrible because of the logic. What does it mean and how do I improve my codes?
Code:#include<stdio.h>#include<math.h> #include<stdlib.h> #define M_PI double CalcRadius(int x); int x; double y; int main(){ printf("Enter the radius of the circle\n"); scanf("%d",&x); double CalcRadius(int x); printf("The area of the circle is %f\n",y); return 0; } double CalcRadius(int x) { y= M_PI*x*x; return y; }