Area and Perimeter of a rectangle – CSKC
Sign In

Search

Code Learning #CPP#7597    siteicon   siteicon  

Area and Perimeter of a rectangle

Source Code

TC++ #7597

Source Code

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

Code Understanding

This program calculates the area and perimeter of a rectangle.
• #include allows input and output commands.
• float l, b; creates two variables to store the length and breadth.
• cin >> l >> b; takes input values from the user.
• area = l * b; calculates the area using the formula length × breadth.
• peri = 2 * l + 2 * b; calculates the perimeter using the formula 2 × (length + breadth).
• cout displays the area and perimeter.
• return(0); ends the program.


Share

Created: 1-Mar-2026 16:04 | Updated: 2-Sep-2026 16:23|