C Program To Calculate Perimeter Of Rhombus | C Programs

C Program to calculate the perimeter of rhombus in three different ways. Check out our other C Beginner programs. We have written the code in three different ways, with sample outputs and example program.

Using Standard

1)The value of entered side of rhombus will store into  variable”side”

2)Using perimeter=4*side formula we calculate the perimeter value


Using Functions

1)p=perimeter(s) using this code we are  calling the perimeter function.

2)float perimeter(float s) returns the perimeter value and perimeter value will assigned to p.


Using Pointers

1)We are passing the addresses of s,p variables using perimerer(&s,&p) function.

2)void perimeter(float *s,float *p) retrieve  the values at  that addresses and calculate the perimeter value

3)The perimeter value will be store in to pointer variable *p


Using Macros

1)Here 4*s formula was defined with the name area(s)

2)area(s) replaced with that expression given at #define.


If you do have any doubts, the just leave a comment here.

Add a Comment

Your email address will not be published. Required fields are marked *