C Programming code to calculate area of a circle

C Programming code to calculate area of a circle by defining pi as 3.1415
Algorithm

  1. Define pi as 3.1415 since pi is not a predefined constant in C
  2. Accept the radius of the circle
  3. Calculate the area of the circle
  4. Display the output

Code
#include<stdio.h>
#include<conio.h>
#define pi 3.1415
void main()
{
clrscr();
int r;
float a;
printf("Enter the radius of a circle. \n");
scanf("%d",&r);
a=pirr;
printf("\n Radius= %d",r);
printf(" \n Area= %f",a);
getch();
}

Share this article:
Previous Post: C program to find sum and average of two numbers

October 1, 2014 - In Academics, Computers

Next Post: C Programming for Fare Calculation

October 1, 2014 - In Academics, Computers

Related Posts

Leave a Reply

Your email address will not be published.