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;
float CalArea( float base, float height)
{
return (base * height);
}
int main()
{
float base, height, Area;
base = 30;
height = 40;
Area = CalArea(base, height);
cout << "Area of Parallelogram is :" << Area;
return 0;
}
|
C
#include <stdio.h>
float CalArea( float base, float height)
{
return (base * height);
}
int main()
{
float base, height, Area;
base = 30;
height = 40;
Area = CalArea(base, height);
printf ( "Area of Parallelogram is : %f\n" , Area);
return 0;
}
|
Java
public class parallelogram {
public static void main(String args[])
{
int base = 30 ;
int height = 40 ;
int area_parallelogram = base * height;
System.out.println( "Area of the parallelogram = " + area_parallelogram);
}
}
|
Python
base = 30
height = 40
area_parallelogram = base * height
print ( "Area of the parallelogram = " + str (area_parallelogram))
|
C#
using System;
class parallelogram
{
public static void Main()
{
int b_ase = 30;
int height = 40;
int area_parallelogram = b_ase * height;
Console.WriteLine( "Area of the parallelogram = " +
area_parallelogram);
}
}
|
PHP
<?php
$base = 30;
$height = 40;
$area_parallelogram = $base * $height ;
echo "Area of the parallelogram = " ;
echo $area_parallelogram ;
?>
|
Javascript
<script>
let base = 30;
let height = 40;
let area_parallelogram=base*height;
document.write( "Area of the parallelogram = " );
document.write(area_parallelogram.toFixed(6));
</script>
|
Output:
Area of Parallelogram is : 1200.000000
Time Complexity: O(1)
Auxiliary Space: O(1)
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!
Last Updated :
03 Mar, 2023
Like Article
Save Article