C program for calculating Area and Circumference of the Circle in C language. In this program, we are taking the input for the Radius.
The value for pi, area and ci [circumference] is float. So I have defined it with Float datatype.
Area of the Circle : Pie * (r)^2
Circumference : 2 * Pie * r
The following program is written and compiled in DEV C++ and it will work with Turbo C also. If you want to run it in ubuntu, remove header #include<conio.h> and getch() function because conio is not defined under gcc.
Code:
#include<stdio.h> #include<conio.h> void main(){ int r; float pi=3.14,area,ci; printf("Enter Radius of circle: "); scanf("%d",&r); area=pi*r*r; printf("Area of Circle= %f\n",area); ci=2*pi*r; printf("Circumference = %f",ci); getch(); }