Q:

Program to find the area of the parallelogram

belongs to collection: Basic Programs

0

The parallelogram is a four-sided plane rectilinear figure with opposite sides parallel. A parallelogram is a simple object in 2D space having two parallel sides. The opposite sides and the angles are identical in parallelogram.

Formula

Area of parallelogram= base x height  

Algorithm

  1. Define the base of the parallelogram.
  2. Define the height of the parallelogram.
  3. Calculate the area of the parallelogram as base X height

Complexity

O(1)

Input:

base = 4

height = 18;  

Output:

Area of Parallelogram = base * height;
                      = 4 * 18
                      = 72

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

C Program

#include <stdio.h>  
int main()  
{  
  int base=4;  
  int height=18;  
  int area_parallelogram=base*height;  
  printf("Area of the parallelogram=%d",area_parallelogram);  
  return 0;  
} 

 

Output:

Area of the parallelogram=72  

 

PHP Program

<?php    
   $base=4;  
   $height=18;  
   $area_parallelogram=$base*$height;  
    echo "Area of the parallelogram=";  
    echo $area_parallelogram;  
?>  

 

Output:

Area of the parallelogram=72  

 

Java Program

public class parallelogram{  
    public static void main(String args[])  
    {  
   int base=4;  
  int height=18;  
  int area_parallelogram=base*height;  
 System.out.println("Area of the parallelogram="+area_parallelogram);  
     }  
}  

 

Output:

Area of the parallelogram=72

 

C# Program

using System;  
                      
public class Program  
{  
    public static void Main()  
    {  
int base1=4;  
  int height=18;  
  int area_parallelogram=base1*height;  
      
   Console.WriteLine("Area of the parallelogram="+area_parallelogram);  
    }  
}  

 

Output:

Area of the parallelogram=72

 

Python Program

base=4  
height=18  
area_parallelogram=base*height  
print("Area of the parallelogram="+str(area_parallelogram))  

 

Output:

Area of the parallelogram=72  

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Program to find the area of the square... >>
<< Program to find the area of a pentagon...