Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)
C Program Area Of Rectangle | C Programs
Latest :

C Program Area Of Rectangle | C Programs

C Program to find the area of a rectangle – In this particular article, we will discuss how to calculate the area of a rectangle in C Programming. The methods used in this specific article are as follows:

  • Using Standard Method
  • Using Function
  • Using Pointers
  • Using Macros

As we all know, rectangles are extremely commonly used quadrilaterals. In a rectangle, the opposite sides are equal and parallel. Essentially, every square is a rectangle since its opposite sides are equal and parallel as well.

The area of a rectangle can be calculated as:

Area = Length * Breadth

A rectangle looks like this:

Rectangle

As you can see, the area of this very rectangle can be calculated very easily. The area of this rectangle is:

Area = 9 * 4 = 36 sq. units.

Thus, the different methods with which the area of a rectangle can be calculated in C programming are as follows:

Using Standard Method

1)We declared the variables length,breadth,area.

2)By substituting the values into the formula area=(length*breadth), we will get the value of area which is assigned to the variable “area”.

output:

Using Function

1)We are using the function area(float l, float b) to calculate the area of a rectangle.

2)Using the code area(l,b) we are calling the function. here area(l,b) is calling function.

3)The called function area(float l, float b) will calculate the area and return the value, that return value will be assigned to the variable “a”.

output:

Using Pointers

1)We are passing the references as arguments using the calling function area(&l,&b,&a).

2)The called function area(float *l, float *b, float *area) will calculate the area of a rectangle, which is having pointer variables as arguments.

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

output:
Using Macros

1)area(l,b) is symbolic name to the expression (l*b).

2)In the code area(l,b) replaced with that expression given at #define.

output:
x

Check Also

C Program To Count The Total Number Of Notes In A Amount | C Programs

C program to count the total number of notes in a given amount – In ...

atakoy escortatakoy escortbakırköy escorthalkali escortbağcılar escortsightcaredeneme bonusu veren siteleristanbul, escortromabetdeneme bonusu veren sitelerdeneme bonusu veren sitelerDeneme Bonusu Veren Sitelercasino siteleriDeneme Bonusu Veren SitelerAlanya Escortcasino sitelerimatbetgrandpashabet güncel girişgrandpashabetgrandpashabetGrandpashabetsloticapalacebetgrandpashabetmarsbahis girişcasibom girişmeritking girişholiganbetescort antalyabahcesehir masaj salonucasibom girişMarsbahiskralbetcasibomdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelerroyalbet güncel girişcasinofastgrandpashabetcasinofastroyalbetgrandpashabetinat tvpusulabetgrandpashabetgrandpashabetcasibom girişcasibommarsbahisbetexperextrabetbahsegel girişbahsegelkralbet girişkralbetbetciobetcio girişmatbetcasino siteleribets10kriptobet girişjojobet girişjojobet girişsuperbet girişsuperbetsuperbetmilanobet girişmilanobet girişmilanobetholiganbetjojobetodeonbetmatbetimajbetmatbetbetparkmaltcasinomaksibetgrandpashabet1xbet girişbahsine girişmaltcasino girişmeritkingdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelerromabetistanbul escortgrandpashabetgrandpashabetgrandpashabetpadişahbetgrandpashabetgrandpashabet girişportobetzbahiszbahis girişonwinotobetotobet girişkralbetkralbet girişmadridbetmadridbet girişmarsbahismarsbahisramadabetcasibomsekabetCasibommatbetcasibomgrandpashabetroyalbetgrandpashabetdedebetcasibomcasibomcasibomcasibom girişcasibom girişpadişahbetMeritkinghttps://www.paidverts.com/lang/royalbetjojobet girişonwin güncel girişmeritkingroyalbetgrandpashabetcasibom girişgrandpashabetvdcasinoholiganbetpusulabetmarsbahisgrandpashabetgrandpashabetpusulabetmarsbahisgrandpashabetimajbetroyalbetholiganbet güncel girişsuperbetmadridbet