# area of a circle

• 10-02-2006
wise_ron
area of a circle
Code:

```/* Program 3: Write a program that reads in the radius of a circle and prints                           the circle's diamater, circumference, and area. Use the constant                           value 3.1459 fo pie. Do thes calculations in output statements. */ #include<stdio.h> #include<math.h> // math library #define PI 3.1416 int main(void) {         float radius, diamater, circumference, area;                 printf("Please enter the radius of your circle: ");         scanf("%f",&radius); //stores variable                 diamater = radius*2;  // calculates radius         circumference = PI*diamater; // calculates circumference         area= (PI)*radius*(exp(2)); // to calculate exponent                 printf("Diameter: %0.2f\n", diamater);         printf("Circumference: %0.2f\n", circumference);         printf("Circle Area: %0.2f\n", area);         return 0; }```
I have problem with the math function. I want to have this for the formula area= PI*radius^2, so i decided to use the math.h with the exp function but something is wrong. Can some one help me, thanks for your help
• 10-02-2006
SirNot
Use the pow() function for exponents, although in your case it's probably easiest to simply put radius*radius.
• 10-02-2006
wise_ron
Thanks
thanks SirNOt for helping me out.