Home » C solved programs » C basic 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.

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





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.