C Program Area Of Rhombus | C Programs

C Program to find the area of rhombus – With the help of the following code you can find the area of the rhombus C program. If you have got the new method – then you can post over here. We do respond to it.

1 Standard Method

1)To calculate the area of Rhombus we need values of two daigonals

2)Diagonal1 will store into d1,diagonal2 store into d2,.

3)d1,d2 will substitute int o the formula we will get area.

output:

Using Function

1)We are calling the function using the code area(d1,d2),here d1,d2 are two diagonals .

2)The called function float area(float d1,float d2) will calculate the area and returns the value.

3)The return value will assigned to the variable “a”.

output:

Using Pointers

1)We are passing the references as arguments using the calling function area(&d1,&d2,&a)

2)The called function area(float *d1,float *d2,float *area) will calculate the area by retrieving the values at that addresses .

3)The calculated value will store into the pointer variable “area”.

output:

Using Macros

1)area(d1,d2) is symbolic name to the expression (d1*d2)/2.

2)area(d1,d2)replaced with that expression given at #define.

output:

Add a Comment

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