Home » » C Program - Calculation of Area and Circumference of a Circle using Pointers

C Program - Calculation of Area and Circumference of a Circle using Pointers

C Program for Calculation of Area and Circumference of a Circle using Pointers.
Write a function that calculates both Area and Perimeter/ Circumference of the Circle, whose Radius is entered through the keyboard.

#include
main()
{

int radius;
float area, perimeter;

printf("\nEnter radius of a circle:");

scanf ("%d", &radius);
areaperi (radius, &area, &perimeter);

printf("Area=%f", area);
printf("\nPerimeter=%f", perimeter);

}


areaperi(int r, float *a, float *p)

{
*a=3.14*r*r;
*p=2*3.14*r;

}



0 comments:

Post a Comment