Showing posts with label Write a C Program to calculates the area (floating point number with two decimal places) of a Circle given it’s radius (integer value). The value of Pi is 3.14.. Show all posts
Showing posts with label Write a C Program to calculates the area (floating point number with two decimal places) of a Circle given it’s radius (integer value). The value of Pi is 3.14.. Show all posts
Sunday, August 6, 2023

Write a C Program to calculates the area (floating point number with two decimal places) of a Circle given it’s radius (integer value). The value of Pi is 3.14.



Write a C Program to calculates the area (floating point number with two decimal places) of a Circle given it’s radius (integer value).  The value of Pi is 3.14.


Program-


#include <stdio.h>

#define PI 3.14

void main()

{

    int radius;

    float area;

    /* Enter the radius of a circle */

    scanf("%d", &radius);

area = PI * radius * radius;  

printf("Area of a circle = %5.2f", area);
}


InputOutput
Test Case 1
42
Area of a circle = 5538.96