# C program to calculate and print area and circumference of a circle

## Problem In Hand

C Program to calculate and print area and circumference of circle

The above program can be solved in following ways:

Without using function
Using functions with out passing arguments
Using function by passing arguments

## Process and Solution Of Problem

Take input for radius of rectangle and store in variables
calculate and store area of circle in a variable.
calculate and store circumference of circle in another variable.
further display area and circumference

## Program/Source Code

### Solution without functions

```#include <stdio.h>
#define pi 3.1415
int main()
{
float r,a,c;
scanf("%f",&r);
a=pi*r*r;
c=2*pi*r;
printf("Area = %f\n",a);
printf("Circumference = %f\n",c);

return 0;
}
```

Output:

case 1:

Area = 16.618534
Circumference = 14.450900

case 2:

Area = 84.946152
Circumference = 32.671600

### Solution using functions without arguments

```#include <stdio.h>
#define pi 3.1415
void circle()
{
float r,a,c;
scanf("%f",&r);
a=pi*r*r;
c=2*pi*r;
printf("Area = %f\n",a);
printf("Circumference = %f\n",c);
}
int main()
{
circle();
return 0;
}
```

Output:

Area = 2010.842651
Circumference = 158.959900

### Solution using functions with arguments

```#include <stdio.h>
#define pi 3.1415
void circle(float r)
{
float a,c;
a=pi*r*r;
c=2*pi*r;
printf("Area = %f\n",a);
printf("Circumference = %f\n",c);
}
int main()
{
float r;
scanf("%f",&r);
circle(r);
return 0;
}
```

Output:

Area = 642.405334
Circumference = 89.846901

### Interview Questions

C Programming
C++ Programming
Class 11 (Python)
Class 12 (Python)
C Language
C++ Programming
Python

C Interview Questions
C++ Interview Questions