Q:

Write a C program to find area and perimeter of circle

0

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.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C programming Basic Input, Output, if else, Ternary Operator based Programs

Similar questions


need a help?


find thousands of online teachers now
Write a C program to find area of rectangle... >>
<< Write a C program to demonstrate example of escape...