×

C Programs

C Basic & Conditional Programs

C Looping Programs

C String Programs

C Miscellaneous Programs

C program to find area and perimeter of circle

This program will read radius of the circle and find the area and perimeter of the circle.

How to find area and perimeter of circle?

To find area and perimeter of circle, use the following formulas:

Area of circle is calculated by PI*R2

Perimeter of the circle is calculated by 2*PI*R

Here, "R" is the radius of the circle, in this program we have a macro defined as PI with the value of PI and variable rad holds the radius entered by the user.

Read more on wiki: Area of a circle, Perimeter/Circumference

Area and Perimeter of circle program in c

/*C program to find area and perimeter of circle.*/
 
#include <stdio.h>
 
#define PI 3.14f
 
int main()
{
    float rad,area, perm;
 
    printf("Enter radius of circle: ");
    scanf("%f",&rad);
 
    area=PI*rad*rad;
    perm=2*PI*rad;
 
    printf("Area of circle: %f \nPerimeter of circle: %f\n",area,perm);
    return 0;
}

Output

Enter radius of circle: 2.34
Area of circle: 17.193384
Perimeter of circle: 14.695200

C Basic Programs »

Related Programs

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.