Program to find the Area of the circle by taking its radius from the user.| Using C language| very Basic| C Program series 04|
👨💻Program to find the Area of the circle by taking its radius from the user.
Code:
//Program to accept the value of a circle's radius and print its area.
#include<stdio.h>
#define pie 3.141592
//Here, we declare a variable named 'pie' and assigned its value by using the syntax LIKE:"#define variable_name value".
//Here, the value of the pie variable is fixed for this whole program. (can not change it further in this code(program) except here.)
main()
{
printf("Program to accept the value of radius and print area of a circle.\n");
float radius,area;
//Here, we declared two variables named 'radius' & 'area'.
printf("\nEnter the value of radius:");
scanf("%f",&radius);//Take value of radius from user.
area=pie*radius*radius;
printf("--> Area of a CIRCLE: %f",area);
}
Output:
Comments
Post a Comment