Program in C that reads radius of a circle and calculates its area

The below program in C will accepts the radius of a circle from the user and calculates its area and displays the calculated result to the user on the screen.

Explanation
Step 1: Read the radius
Step 2: Calculate the area by applying the formula: Area = (pi)*r2 = 3.14 * r2

#include<stdio.h>
#include<conio.h>
 
void main()
{
    float radius, area;
    printf("Radius = ?");
    scanf("%f", &radius);

    //calculate the area
    area = 3.14 * radius * radius;

    //display the calculated result
    printf("Area = %f", area);
        
    getch();
}

Output:

Radius = ?5
Area = 78.500000

You may also like...

1 Response

  1. July 5, 2014

    […] Program in C that reads radius of a circle and calculates its area […]

Leave a Reply

Your email address will not be published. Required fields are marked *

FREE C Cheatsheet - Speed Up Your C Programming.

FREE C Cheatsheet - Speed Up Your C Programming.

Download a 7-page free cheat sheet for easy and quick access to C Concepts, Snippets, and Syntax.

Thank you! Check you inbox and access your cheat-sheet