Program to find the Area of a Parallelogram
Given the sides of a Parallelogram, task is calculate the area of a Parallelogram.
Examples:
Input: base = 30, height = 40 Output: 1200.000000 As Area of parallelogram = base * height, Therefore, Area = 30 * 40 = 1200.00
Approach:
Area of parallelogram = base * height
Below is the implementation of the above approach:
C++
#include <iostream> using namespace std; // function to calculate the area float CalArea( float base, float height) { return (base * height); } // driver code int main() { float base, height, Area; base = 30; height = 40; // function calling Area = CalArea(base, height); // displaying the area cout << "Area of Parallelogram is :" << Area; return 0; } |
chevron_right
filter_none
C
#include <stdio.h> // function to calculate the area float CalArea( float base, float height) { return (base * height); } // driver code int main() { float base, height, Area; base = 30; height = 40; // function calling Area = CalArea(base, height); // displaying the area printf ( "Area of Parallelogram is : %f\n" , Area); return 0; } |
chevron_right
filter_none
Java
public class parallelogram { public static void main(String args[]) { int base = 30 ; int height = 40 ; // formula for calculating the area int area_parallelogram = base * height; // displayin g the area System.out.println( "Area of the parallelogram = " + area_parallelogram); } } |
chevron_right
filter_none
Python
base = 30 height = 40 # formula for finding the area area_parallelogram = base * height # displaying the output print ( "Area of the parallelogram = " + str (area_parallelogram)) |
chevron_right
filter_none
C#
using System; class parallelogram { public static void Main() { int b_ase = 30; int height = 40; // formula for calculating the area int area_parallelogram = b_ase * height; // displayin g the area Console.WriteLine( "Area of the parallelogram = " + area_parallelogram); } } // This code is contributed by vt_m |
chevron_right
filter_none
PHP
<?php $base = 30; $height = 40; $area_parallelogram = $base * $height ; echo "Area of the parallelogram = " ; echo $area_parallelogram ; ?> |
chevron_right
filter_none
Output:
Area of Parallelogram is : 1200.000000
Recommended Posts:
- Find area of parallelogram if vectors of two adjacent sides are given
- Perimeter and Area of Varignon's Parallelogram
- Area of a triangle inside a parallelogram
- Program to find the area of a Square
- Program to find the Area of Pentagon
- Program to find the Area of an Ellipse
- Program to find area of a triangle
- Program to find area of a circle
- Program to find area of a Trapezoid
- Program for Circumference of a Parallelogram
- Program to find the Area and Volume of Icosahedron
- Program to find the Area and Perimeter of a Semicircle
- Program to find area of a Circular Segment
- Program to find the surface area of the square pyramid
- Program to print the hollow numerical parallelogram
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : vt_m