It then searches for the value of "pi" which has been defined as a macros. Then it takes in the input for the radius and goes to the calculation part. Then two 4(assuming 32/64-bit system) bits memory space are created for the two float variable. In the above program the compiler first compiling from the main function (here int main()). #define pi 3.14 //macros where the value of pi is definedĪreaOfCircle = pi * radius * radius //Calculating the area of the circleĬout<<"Area of the circle\n"<<areaOfCircle<<endl Ī macros is defined in the above program ( #define pi 3.14). Macros are defined so that the program run faster and is very efficient while doing competitive programming. Given below is the C code where we take radius of the circle as an input and the area of the circle is given as the output. Write a C program to find the area of the circleĬ program to calculate the area of a circle.We start by looking at a simple example where we calculate the area of a circle. In this C program tutorial our task is to: The text has to follow a certain syntax to be a valid Fortran program.
0 Comments
Leave a Reply. |