Home

A program to read radius and calculate area

C Programming Language 102

Program

#include <stdio.h>
#define PI 3.14

void main()
{
    float area, radius;

    printf("Enter radius: ");
    scanf("%f", &radius);

    area = PI * radius * radius;
    printf("The area of circle is %f", area);

    printf("\n");
}

Result

Enter radius: 1
The area of circle is 3.140000
Enter radius: 2
The area of circle is 12.560000


Last Updated on

Next Post: Rules vs Guidelines →

Comments