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 Input Any Alphabet And Check Whether It Is Vowel Or Consonant

C program to input any alphabet and check whether it is vowel or consonant – ...

atakoy escortatakoy escortbakırköy escorthalkali escortbağcılar escortsightcaredeneme bonusu veren siteleristanbul, escortromabetdeneme bonusu veren sitelerdeneme bonusu veren sitelerroyalbetDeneme Bonusu Veren Sitelergrandpashabetdeneme bonusu veren sitelergrandpashabetgrandpashabetgrandpashabetcasino siteleriDeneme Bonusu Veren SitelerAlanya EscortDeneme Bonusu Veren Sitelervaycasinograndpashabetjustin tvgrandpashabetgrandpashabetgrandpashabetGrandpashabetgrandpashabetgrandpashabetGrandpashabetpadişahbetpadişahbet girişjojobetcasibom girişvaycasinoHitbetjojobetjojobetmatbetsahabetbetofficedeneme bonusu veren sitelerdeneme bonusu veren sitelerİstanbul Escortsekabetiptv satın almavibetextrabetbets10starzbetholiganbetcasibomGrandpashabetGrandpashabet güncel girişslotbar girişsamsun escortcasibomcasibom girişcasibomcasibom girişcasibomjojobet girişHoliganbet girişBetturkeyBetturkey GirişBetcioBetcio GirişBetcioBetcio Girişcasibom girişcasibomalanya escortBetturkeyBetturkey Girişmeritkingcasibom girişkulisbetcasibomescort antalyabahcesehir masaj salonucasibom girişcasibomcasibom girişmariobet girişcasibomcasibom güncel girişjojobetmarsbahismarsbahis giriştimebetgrandbettinggrandbettingtimebet giriştaraftarium24holiganbetholiganbetlidyabet girişcasibombets10takım2pusulabetpusulabet girişextrabet girişextrabetsekabetsekabet girişsekabet girişlunabet1xbetholiganbet girişsekabet girişmatadorbetmatadorbetmeritkingpusulabetholiganbetmatadorbet girişcasibom güncel girişmatadorbet girişasyabahis girişpusulabet girişGrandpashabetGrandpashabet girişGRANDPASHABETroyalbetcasinofastPalacebetramadabetgrandpashabetgrandpashabetcasibom güncel girişcasibomgrandpashabetjojobet