xxxxxxxxxx
#include <stdio.h>
#define PI 3.142
int main(){
float r, C, A;
printf("What is the radius: \n");
scanf("%f", &r);
C = 2 * PI * r;
A = PI * r * r;
printf("\nCincumference is and %f Area is %f\n", C, A);
}
xxxxxxxxxx
C = Pi * r * 2 (r stands for radius)
Or you could do this:
C = Pi * d (d stands for diameter)
xxxxxxxxxx
from math import pi
Circumference = pi * diameter
Circumference = pi * 2 * radius
xxxxxxxxxx
CLS
INPUT “Radius of circle”; r
Area=3.14*r*r
PRINT “Area of a circle is”; Area
END
xxxxxxxxxx
void main()
{
int radius = 7;
double pi = 22/7;
print("Area is ${pi * radius * radius}");
print("Circumference is ${2 * pi * radius}");
}
xxxxxxxxxx
import math
def calculate_circumference(radius):
return 2 * math.pi * radius
# Example usage:
radius = 5
circumference = calculate_circumference(radius)
print(f"The circumference of a circle with radius {radius} is {circumference:.2f}")