C Programming Code Examples C > Beginners Lab Assignments Code Examples Program to find diameter, circumference and area of circle using PI constant Program to find diameter, circumference and area of circle using PI constant Write a C program to input radius of a circle from user and find diameter, circumference and area of the circle. How to calculate diameter, circumference and area of a circle whose radius is given by user in C programming. #include <stdio.h> #include <math.h> // Used for M_PI int main() { float radius, diameter, circumference, area; /* Input radius of circle from user */ printf("Enter radius of circle: "); scanf("%f", &radius); /* Calculate diameter, circumference and area of circle */ diameter = 2 * radius; circumference = 2 * M_PI * radius; area = M_PI * (radius * radius); /* Print all results */ printf("Diameter of circle = %.2f units \n", diameter); printf("Circumference of circle = %.2f units \n", circumference); printf("Area of circle = %.2f sq. units ", area); return 0; }