C Program to Calculate Area of Circle using Pointer

Calculate Area of Circle using Pointer :

#include<stdio.h>

void areaperi ( int r, float *a, float *p )
{
*a = 3.14 * r * r ;
*p = 2 * 3.14 * r ;
}

void 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 ) ;
}

Output:

Enter radius of a circle 5
Area = 78.500000
Perimeter = 31.400000

Share this

Related Posts

Previous
Next Post »

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer